-
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
Merged
Merged
D3visualizer #920
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
755064b
Refactor of all code for new d3 visualization, now if you want to ena…
hadesbox 3e50457
Changing edges labels
hadesbox 3c1c919
adding link to the graph nodes, so its possible to navigate the graph…
hadesbox 69304c7
Adding scheduler class to server.py, to fetch config properties to ke…
hadesbox 916c9b0
Removing pep8 error: luigi/server.py:217:30: E222 multiple spaces aft…
hadesbox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright 2012-2015 Spotify AB | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import os | ||
import shutil | ||
import time | ||
import random | ||
|
||
import luigi | ||
|
||
max_depth = 10 | ||
max_total_nodes = 50 | ||
current_nodes = 0 | ||
|
||
|
||
class Foo(luigi.Task): | ||
|
||
def run(self): | ||
print "Running Foo" | ||
|
||
def requires(self): | ||
global current_nodes | ||
for i in xrange(30 / max_depth): | ||
current_nodes += 1 | ||
yield Bar(i) | ||
|
||
|
||
class Bar(luigi.Task): | ||
|
||
num = luigi.IntParameter() | ||
|
||
def run(self): | ||
time.sleep(1) | ||
self.output().open('w').close() | ||
|
||
def requires(self): | ||
global current_nodes | ||
|
||
if max_total_nodes > current_nodes: | ||
valor = int(random.uniform(1, 30)) | ||
for i in xrange(valor / max_depth): | ||
current_nodes += 1 | ||
yield Bar(current_nodes) | ||
|
||
def output(self): | ||
""" | ||
Returns the target output for this task. | ||
|
||
:return: the target output for this task. | ||
:rtype: object (:py:class:`~luigi.target.Target`) | ||
""" | ||
time.sleep(1) | ||
return luigi.LocalTarget('/tmp/bar/%d' % self.num) | ||
|
||
|
||
if __name__ == "__main__": | ||
if os.path.exists('/tmp/bar'): | ||
shutil.rmtree('/tmp/bar') | ||
|
||
luigi.run(['--task', 'Foo', '--workers', '2'], use_optparse=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; } | ||
.tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; } | ||
|
||
/* Rounded corners */ | ||
.tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; } | ||
|
||
/* Uncomment for shadow */ | ||
.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; } | ||
|
||
.tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; } | ||
|
||
/* Rules to colour arrows */ | ||
.tipsy-arrow-n { border-bottom-color: #000; } | ||
.tipsy-arrow-s { border-top-color: #000; } | ||
.tipsy-arrow-e { border-left-color: #000; } | ||
.tipsy-arrow-w { border-right-color: #000; } | ||
|
||
.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; } | ||
.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} | ||
.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} | ||
.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } | ||
.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } | ||
.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } | ||
.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; } | ||
.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'
toFoo
andBar
?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.