Skip to content

Remove parameter caching inside task class - #370

Merged
callumforrester merged 5 commits into
mainfrom
stop-caching-params
Feb 7, 2024
Merged

callumforrester merged 5 commits into
mainfrom
stop-caching-params

Conversation

@callumforrester

@callumforrester callumforrester commented Feb 7, 2024 •

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Feb 7, 2024 •

Copy link
Copy Markdown

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.

@joeshannon joeshannon left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
@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