Skip to content
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

DM-30869: Modernize MetricTask for better Gen 3 workflow #105

Merged
merged 9 commits into from Sep 20, 2022

Conversation

kfindeisen
Copy link
Member

This PR removes some unused features from MetricTask, namely the requirements that subclasses accept None input and built-in handling of MetricComputationError. These changes significantly simplify subclass code and bring MetricTask closer in line with current PipelineTask conventions.

This case was never supported by Gen 3 Middleware (i.e., it never came
up in pipeline execution) and made concrete task implementations more
complicated than they otherwise needed to be.
Now that MetricTask no longer requires that MetadataMetricTask supports
`None` datasets, the corresponding code can be removed from
MetadataMetricTask. Note that the task still guards against missing
keys, as the content of a metadata object is something that Middleware
cannot guarantee.
Now that MetricTask no longer requires that ApdbMetricTask supports
`None` datasets, the corresponding code can be removed from
ApdbMetricTask. Note that the task still guards against missing
information inside the config, as the content of a dataset is something
that Middleware cannot guarantee.
When a metric does not apply, MetricTask can now *either* raise NoWorkFound or
return None. This is standard behavior for PipelineTasks, though the
documentation emphasizes in which circumstances this is appropriate as opposed
to MetricComputationError.
This change allows for slightly simpler code and more idiomatic error
handling. MetadataMetricTask acknowledges NoWorkFound but does not
require it.
This change simplifies the code and makes error handling more idiomatic.
Exceptions are now better handled by the Middleware framework, so it's
counterproductive for MetricTasks to do it themselves. MetricTasks must
still handle None output themselves, though.
Exceptions are now better handled by the Middleware framework, though
MetricTasks to support None output themselves. However, the simplified
runQuantum still reduces maintenance for subclasses that override
runQuantum themselves.
@kfindeisen kfindeisen merged commit 1b7182a into main Sep 20, 2022
@kfindeisen kfindeisen deleted the tickets/DM-30869 branch September 20, 2022 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants