-
Notifications
You must be signed in to change notification settings - Fork 68
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
Recipe and recipe execution #1117
Conversation
This lacks tests, documentation, and probably has bugs. But I wanted to get this out in front of you guys sooner rather than later. |
Codecov Report
@@ Coverage Diff @@
## tonytung-runnable #1117 +/- ##
=====================================================
+ Coverage 89.07% 89.31% +0.24%
=====================================================
Files 131 132 +1
Lines 4980 5065 +85
=====================================================
+ Hits 4436 4524 +88
+ Misses 544 541 -3
Continue to review full report at Codecov.
|
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 read the tests, everything looks good from a user perspective. I didn't read the code in detail (can I leave @shanaxel42 to do that part of the review?)
You're going to add some documentation about how a user would use this, right? :-)
|
||
result_stack = ImageStack.from_path_or_url(output_path) | ||
assert np.allclose( | ||
BASE_EXPECTED * .5, |
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.
Testing suggestion:
Change the multiplicands to 0.5, 2.0, 4.0, and the expected to BASE_EXPECTED * 4
; as the test stands, it would pass if only the first compute
call executed for some reason.
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 did something similar to what you suggested.
self.runnable_dependents: Mapping[Runnable, AbstractSet[Runnable]] = runnable_dependents | ||
|
||
# completed results | ||
self._completed_runnables: Set[Runnable] = set() |
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.
Does this imply that you could never have duplicate runnables?
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.
Yes, even runnables with the same parameters are treated as distinct entities.
starfish/recipe/recipe.py
Outdated
while True: | ||
candidate_runnable = next(self._runnable_sequence) | ||
|
||
if candidate_runnable in self.needed_runnables: |
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.
what exactly does self.needed_runnables mean in this context?
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.
As discussed offline, this is undesirable, and as such, removed.
starfish/recipe/recipe.py
Outdated
if dependency not in runnable_dependents: | ||
runnable_dependents[dependency] = set() | ||
runnable_dependents[dependency].add(runnable) | ||
Execution.build_graph(dependency, needed_runnables, runnable_dependents) |
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.
cool
"compute": ordered_sequence, | ||
"file_outputs": outputs, | ||
} | ||
ast = compile(recipe_str, "<string>", "exec") |
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.
what does ast stand for?
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.
abstract syntax tree.
starfish/recipe/recipe.py
Outdated
ast = compile(recipe_str, "<string>", "exec") | ||
exec(ast, recipe_scope) | ||
|
||
assert len(outputs) == len(output_paths), \ |
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.
outputs == fileoutputs
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.
done.
d680299
to
9458cd6
Compare
a56438c
to
f220346
Compare
e4db852
to
caeb9b7
Compare
dc3e260
to
c1fb51b
Compare
c3f09a5
to
dcd0212
Compare
Builds on top of #1097 to construct and run recipes with one or more runnables.
A recipe wires together one or more runnables. Inputs to recipes are available to the recipe itself as the magic variable name "file_inputs". A runnable is invoked by the magic function "compute". Anything written to the magic variable "file_outputs" is matched and written out to a set of output paths.
Fixes #311