Try sharing common parts of workflow compute to make tests run faster #182
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.
This is demonstrating an approach that could save some test runtime. In this example a parametrized test is running a nearly identical workflow 8 times, each time loading data from scratch, etc.
The change here moves some of the common parts into a module-scope fixture. On my machine this reduces the test runtime from 50 seconds to 22 seconds.
I do not know if this is a great solution. If we want to go with this, a helper utility could be made: Given a sciline.Pipeline and a set of keys, compute all intermediate results that to not depend on those keys and set the results as "static" data in the workflow. This would avoid error-prone manual authoring of fixtures like the one I added here.