-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
D3visualizer #920
D3visualizer #920
Conversation
Wow, 25'000 additions? You also seem to have added that 12000-line file twice. Hmm :) |
Nice!! Do you have any screen shots to share? |
I don't know if it would be possible to add management of the js dependencies without complexifying the the installation. |
Hi Arash! You are right... we probably did not prepare properly the pull request, but let me explain my self. We create this new visualization for the graphs on d3, and today when we merge with the HEAD of master, we realized that many changes were applied on the last week to the svg graph, mainly performance improvements, also on the forum themalkom suggested that he wanted to keep using current svg, so since there is not stateful backend for luigi's front to store this options, we thought the best was to keep both the SVG and tthe D3 visualizations and that each user can chose which one he wants or likes more. This is the reason why we wanted to keep separated all index.html, visualizerApp.js in separate files (since we modify them). Regarding all those 25k lines I guess most of them are from the d3 static files css+js, we thought we could use some public cdn to fetch them, but since luigi is most likely deployed in a DMZ (at least in our case.. I work for a bank) with no outbound internet connection we discarded this, instead we decided to include them in the commit. If you guys can run the branch https://github.com/hadesbox/luigi/tree/d3visualizer branch in our fork and let us know any comments or suggestion we can work, we will fix them. We tried to have an option on the URL to switch between d3 and svg, but since the URL is the way luigi identifies which graph to show, it was going to be a huge change and we wanted to avoid it. Here they are Eric, its the same example (foo.complex.py) on both svg and d3 that we sent on this pull request so you can compare. cheers! |
BTW you are totally correct Arash, luigi/static/visualiser/js/dagre-d3.js is dupped, will check that. |
@hadesbox Is the many difference between index.html and index.d3.html. Would it be easy to handle this case with template inheritance? Similar for visualiserApp.d3.js. |
Yea, that was what I was refering too. ^^ Anyway. I'll review this soon when I'm done with some other things. I'm really happy to see this being submitted as a PR. I'm fine with a 10k lines of code file being in this PR. As long it's not two identical files like that. :) |
not sure why tests are broken – might have to rebase this one? |
Aparently there are some quality code problems/warnings in the foo.complex example I added, I'll be sure to fix those:
|
btw, I rebased with master on 29th April (before sending the PR), I'll rebase again as needed. |
Also, make sure the remove the duplicate 12000 line file. :) |
Sure Arash. I'm waiting to hear some feedback from you guys before sending another pull request, so if you can try the visualizer and let me know your thoughts. Or should I send the PR directly?? |
Just update this PR I think. I'll try it out then and come with some feedback. I'm in particular interested in seeing if it's renders faster than the svg implementation. :) |
…ble d3 graph you need to set in the config visualization_graph in the [core] section either svg (defaults) or d3. This will tell tornado to return as default home either visualization, in any case regarless of this config param value, you can always to either /static/visualiser/index.html or /static/visualiser/index.d3.html in your browser.
9a00376
to
6518b4e
Compare
So I removed the dupped file (-11k lines), rebased again to latest master, fixed the edge labels to say "secs" and fixed all python-codestyle rules that poped on the last travis, lastely I retested that everything worked as expected. So the PR its ready, let me know if you find anything that should be changed/fixed :). |
@@ -214,7 +214,11 @@ def get(self, path): | |||
class RootPathHandler(tornado.web.RequestHandler): | |||
|
|||
def get(self): | |||
self.redirect("/static/visualiser/index.html") | |||
visualization_graph = configuration.get_config().get('core', 'visualization_graph', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the new syntax instead? core().visualization_graph
I mean, and set the parameter to have a default of "svg" maybe?
On the other hand this is in the server code. Maybe it's good to not intermix with the client logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understood what you mean about
On the other hand this is in the server code. Maybe it's good to not intermix with the client logic.
The server.py was changed so Tornado knows what is the default url to serve index.html or index.d3.html, and this is read from the configuration so there is no client code here I think, actually regarless the configuration of the visualization_graph you can visit in your browser both
localhost:8082/index.html or localhost:8082/index.d3.html.
I will change the code().visualization_graph as you suggested, dont know what else to do here maybe you can suggest some ideas?
Let me know (or post screenshots) of your super mega diagram and let me know if it worked fine :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nah. I just meant that configuration.get_config().get('core', 'visualization_graph', '')
can be replaced with core().visualization_graph
. But that's probably a bad idea as then the server needs to import the client code. Which doesn't make sense. :)
Ignore me :)
LGTM. :) |
@Tarrasch , Im trying to change it like this
can you suggest me a code snippet? I can't find the rest of luigi's code the "new way" to fetch the config params (probably I'm not looking into the right place). |
… and see the deps of a particular node (and not the whole tree).
I pushed a thing we have missed, which is the an click event on the d3 graphs, so you can navigate your graph, once travis finishes I thinks its good to go. |
yield Bar(i) | ||
|
||
|
||
class Bar(luigi.Task): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reasons, can you add task_namespace = 'examples'
to Foo
and Bar
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max_depth, max_total_nodes, current_nodes are global variables, to store the STATE of the graph that is going to get built. The idea is that you can specify by parameters the size and limits of the foo graph. This means that this variables are needed globally within each luigi's task (requires and run) so the graph generation has a stop condition, while been dynamically generated on each run.
Can you use another section instead of Actually, do it the proper way, add a parameter here: Lines 79 to 100 in eab3c4c
Then access it the way you do |
So I think these changes should do the trick you suggest, I have tested them in local and everything is working, if you think they are fine I'll push them so you can review them. luigi/scheduler.pyadding the visualization_graph in the scheduler class, with default value svg. @@ -99,6 +99,8 @@ class scheduler(Config):
record_task_history = parameter.BoolParameter(default=False)
+ visualization_graph = parameter.Parameter(default="svg", config_path=dict(section='scheduler', name='visualization-graph'))
+
def fix_time(x):
# Backwards compatibility for a fix in Dec 2014. Prior to the fix, pickled state might store datetime objects luigi/server.pyI changed the tornado.web.RequestHandler for BaseTaskHistory so it has the initialize method and set the local property scheduler. @@ -211,12 +211,14 @@ class StaticFileHandler(tornado.web.RequestHandler):
self.write(data)
-class RootPathHandler(tornado.web.RequestHandler):
+class RootPathHandler(BaseTaskHistoryHandler):
def get(self):
- visualization_graph = configuration.get_config().get('core', 'visualization_graph', '')
+ visualization_graph = self._scheduler._config.visualization_graph
if visualization_graph == "d3":
self.redirect("/static/visualiser/index.d3.html")
+ elif visualization_graph == "svg":
+ self.redirect("/static/visualiser/index.html")
else:
self.redirect("/static/visualiser/index.html")
@@ -226,7 +228,7 @@ def app(scheduler):
handlers = [
(r'/api/(.*)', RPCHandler, {"scheduler": scheduler}),
(r'/static/(.*)', StaticFileHandler),
- (r'/', RootPathHandler),
+ (r'/', RootPathHandler, {'scheduler': scheduler}),
(r'/tasklist', AllRunHandler, {'scheduler': scheduler}),
(r'/tasklist/(.*?)', SelectedRunHandler, {'scheduler': scheduler}),
(r'/history', RecentRunHandler, {'scheduler': scheduler}), |
Looks good! :) |
…ep backwards compatibility
Ok its pushed. |
Ok, nobody has commented on this for a while, so I merge. :) |
NICE |
If you have comments or improvements let me know on this thread or PM or luigi user forum so we can work on them 👍 |
We have added a new visualization graph with d3, instead of the svg. The svg was not deleted, so you can choose to use between d3 or svg either by using either
The visualization_graph defaults to svg, if the option is not present. In any case you can directly acces the d3 or svg visualizations by going in your browser to
svg -> http://localhost:8082/static/visualiser/index.html
d3 -> http://localhost:8082/static/visualiser/index.d3.html
The new visualization in d3 is much better for bigger graphs, since it auto zooms in the canvas and fits it into the page (without scrolling).
I'm also senfing a new foo.comple.py example, which generates a bigger graph (for testing purposes).
Finally, the d3visualizer branch is update with todays last commit in the official master branch so its should merge smoothly.
cheers!
Luis.