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

Remove parameter caching inside task class #370

Merged
merged 5 commits into from
Feb 7, 2024

Conversation

callumforrester
Copy link
Contributor

@callumforrester callumforrester commented Feb 7, 2024

Closes #369

The validated and processed parameters from a plan request were being cached inside the Task class because they were needed in two separate threads. Unfortunately, with the introduction of the subprocess (#343), pickling was causing issues with the cached object (see #369 for more details).

This PR is the simplest solution: remove the cache and generate the parameters twice. It also adds regression tests for the bug case in #369

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ad943e4) 88.70% compared to head (2a2c650) 88.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #370      +/-   ##
==========================================
+ Coverage   88.70%   88.89%   +0.19%     
==========================================
  Files          43       43              
  Lines        1797     1792       -5     
==========================================
- Hits         1594     1593       -1     
+ Misses        203      199       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@joeshannon joeshannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change look good, thanks!

My only note is that the new tests currently pass on main even without the associated changes to task/reworker.

This is because test_rest_api.py is only using the "internal" non-subprocess handler, and it highlights that we probably need to either convert it (relates partially to #360), or introduce some system tests.

@callumforrester
Copy link
Contributor Author

Yeah I think #360 should go towards solving that, it's useful to have the test regardless

@callumforrester callumforrester merged commit 598d789 into main Feb 7, 2024
23 checks passed
@callumforrester callumforrester deleted the stop-caching-params branch February 7, 2024 10:25
ZohebShaikh pushed a commit that referenced this pull request May 7, 2024
Closes #369

The validated and processed parameters from a plan request were being
cached inside the `Task` class because they were needed in two separate
threads. Unfortunately, with the introduction of the subprocess (#343),
pickling was causing issues with the cached object (see #369 for more
details).

This PR is the simplest solution: remove the cache and generate the
parameters twice. It also adds regression tests for the bug case in #369
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.

Error querying worker task via REST API
2 participants