-
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
Restructure the relationship between PipelineComponent and AlgorithmBase #1095
Conversation
This also partially addresses #921 |
70e9a14
to
d75719f
Compare
Codecov Report
@@ Coverage Diff @@
## master #1095 +/- ##
==========================================
+ Coverage 88.87% 88.89% +0.02%
==========================================
Files 168 168
Lines 6535 6540 +5
==========================================
+ Hits 5808 5814 +6
+ Misses 727 726 -1
Continue to review full report at Codecov.
|
starfish/pipeline/algorithmbase.py
Outdated
|
||
|
||
class AlgorithmBaseType(type): | ||
DISALLOWED_BASES: Set[Type] = 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.
what's an example of a disallowed base?
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.
Let me improve the documentation. Basically, we want the subclasses of FilterAlgorithmBase
, RegistrationAlgorithmBase
, etc., and not the subclasses of AlgorithmBase
.
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 went with a different approach that removed the need for this.
112224b
to
f9ec78f
Compare
f9ec78f
to
581974c
Compare
Rather than each specific PipelineComponent have a link to the AlgorithmBase that describes the contract that the algorithm must implement, each AlgorithmBase implementation points to the PipelineComponent that it serves. The current arrangement forces all the algorithms to be defined and evaluated in the interpreter before the pipeline component is defined and evaluated. If we want to create an algorithm that's only used in tests, this is not possible. The new arrangement ensures that any implementation of a specific AlgorithmBase is registered with its corresponding PipelineComponent. This adds explicit abstract classes to the AlgorithmBase class hierarchy to make it easier to detect what's an actual algorithm implementation. Depends on #1094 Test plan: `make -j fast`
581974c
to
cbc8192
Compare
…ase (#1095) Rather than each specific PipelineComponent have a link to the AlgorithmBase that describes the contract that the algorithm must implement, each AlgorithmBase implementation points to the PipelineComponent that it serves. The current arrangement forces all the algorithms to be defined and evaluated in the interpreter before the pipeline component is defined and evaluated. If we want to create an algorithm that's only used in tests, this is not possible. The new arrangement ensures that any implementation of a specific AlgorithmBase is registered with its corresponding PipelineComponent. This adds explicit abstract classes to the AlgorithmBase class hierarchy to make it easier to detect what's an actual algorithm implementation. Depends on #1094 Test plan: `make -j fast`
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
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 #1095
Restructure the relationship between PipelineComponent and AlgorithmBase
Rather than each specific PipelineComponent have a link to the AlgorithmBase that describes the contract that the algorithm must implement, each AlgorithmBase implementation points to the PipelineComponent that it serves.
The current arrangement forces all the algorithms to be defined and evaluated in the interpreter before the pipeline component is defined and evaluated. If we want to create an algorithm that's only used in tests, this is not possible.
The new arrangement ensures that any implementation of a specific AlgorithmBase is registered with its corresponding PipelineComponent.
This adds explicit abstract classes to the AlgorithmBase class hierarchy to make it easier to detect what's an actual algorithm implementation.
Depends on #1094
Test plan:
make -j fast