-
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
Introduce Runnable #1163
Introduce Runnable #1163
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1163 +/- ##
==========================================
+ Coverage 88.42% 88.55% +0.13%
==========================================
Files 133 137 +4
Lines 4923 5075 +152
==========================================
+ Hits 4353 4494 +141
- Misses 570 581 +11
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.
Looks ok to me. Would like some usage docs for this concept and a pointer to the tip of your tree so that I can test the functionality.
Would like @shanaxel42 or @kne42 to take a close look at the code.
The save method is expected to be called with the object and a string, which is the path to | ||
write the object to. | ||
""" | ||
IMAGESTACK = (ImageStack, imagestack_convert, ImageStack.export) |
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.
Scope creep: I feel the save/load names for our methods should be consistent across the 4 objects we have. What do you think?
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.
LOL you and @shanaxel42 think alike. :)
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.
|
||
|
||
class FileProvider: | ||
"""This is used to wrap paths or URLs that are passed into Runnables via the `file_inputs` magic |
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.
file_inputs
is not used anywhere in this PR, just mentioned in docs. Confused.
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.
it's used in a separate PR. :)
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.
Looks ok to me. Would like some usage docs for this concept and a pointer to the tip of your tree so that I can test the functionality.
check out the branch tonytung-recipe-cli
|
||
|
||
class FileProvider: | ||
"""This is used to wrap paths or URLs that are passed into Runnables via the `file_inputs` magic |
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.
it's used in a separate PR. :)
The save method is expected to be called with the object and a string, which is the path to | ||
write the object to. | ||
""" | ||
IMAGESTACK = (ImageStack, imagestack_convert, ImageStack.export) |
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.
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 think just some more comments in the tests/runnable class explaining stuff would be helpful!
with pytest.raises(ConstructorError): | ||
Runnable( | ||
"filter", "SimpleFilterAlgorithm", | ||
FileProvider(URL), |
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.
why does this error? because we don't provide params?
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. Updated the documentation.
|
||
|
||
def test_run_type_inference_error(): | ||
"""Verify that we get a properly typed error when we cannot properly infer the type for one of |
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.
Could use more explanation here too, maybe some comments about what input causes the error
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.
Fixed, and added more commentary on how to fix this error in the documentation for TypeInferenceError
.
4cb0f6a
to
e7afa06
Compare
Restacked on top of #1218 |
057649b
to
8616308
Compare
e7afa06
to
389da68
Compare
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.
Looks good enough to merge. Should we recipe
-> _recipe
? I am guessing users won't call this from the API.
I may have follow-up comments when I try it out more thoroughly.
) | ||
|
||
|
||
def imagestack_convert(indirect_path_or_url: str) -> ImageStack: |
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.
single-line docstring please: what is this intended to do?
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.
Added doc.
) | ||
|
||
|
||
def codebook_convert(indirect_path_or_url: str) -> Codebook: |
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.
single-line docstring please: what is this intended to do?
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.
Added doc.
Runnable is the base unit of a recipe. Each runnable constitutes a PipelineComponent with a specific algorithm. Constructor arguments that are FileProviders are loaded into memory and passed in. Inputs to the `run()` method can also include FileProviders. In all cases, FileProviders are associated with a file path or url. The type is inferred from the typing parameters of the method (currently supported: ImageStack, IntensityTable, ExpressionMatrix, and Codebook). Runnables will be wired together to constitute a pipeline recipe. Test plan: Added tests to verify a simple Runnable, chained Runnables, and Runnables that has constructor arguments that are FileProviders. Depends on spacetx#1095
389da68
to
0ef68e4
Compare
Runnable is the base unit of a recipe. Each runnable constitutes a PipelineComponent with a specific algorithm. Constructor arguments that are FileProviders are loaded into memory and passed in. Inputs to the
run()
method can also include FileProviders. In all cases, FileProviders are associated with a file path or url. The type is inferred from the typing parameters of the method (currently supported: ImageStack, IntensityTable, ExpressionMatrix, and Codebook).Runnables will be wired together to constitute a pipeline recipe.
Test plan: Added tests to verify a simple Runnable, chained Runnables, and Runnables that has constructor arguments that are FileProviders.
This is a continuation of #1097