Skip to content

ENH add a call_context parameter to Parallel to make it possible to propagate runtime configuration to the workers#1668

Open
glemaitre wants to merge 30 commits into
joblib:mainfrom
glemaitre:call_context_parallel
Open

ENH add a call_context parameter to Parallel to make it possible to propagate runtime configuration to the workers#1668
glemaitre wants to merge 30 commits into
joblib:mainfrom
glemaitre:call_context_parallel

Conversation

@glemaitre

@glemaitre glemaitre commented Feb 26, 2025

Copy link
Copy Markdown
Contributor

This PR allows to call some context manager before calling the function in the parallel context. It provides the following functionalities:

  • add call_context in Parallel to pass a list of context manager
  • provide a registry _CALL_CONTEXT accessible with register_call_context and unregister_call_context and list_call_context_names.
  • add a configuration in joblib with the set_config, get_config, and config_context.
  • register a default config_context for joblib to _CALL_CONTEXT.

@glemaitre
glemaitre marked this pull request as draft February 26, 2025 16:32
@codecov

codecov Bot commented Feb 26, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.29577% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.48%. Comparing base (389daf2) to head (de55bfc).
⚠️ Report is 55 commits behind head on main.

Files with missing lines Patch % Lines
joblib/parallel.py 97.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1668      +/-   ##
==========================================
- Coverage   95.51%   95.48%   -0.03%     
==========================================
  Files          46       47       +1     
  Lines        7711     7849     +138     
==========================================
+ Hits         7365     7495     +130     
- Misses        346      354       +8     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread joblib/test/test_parallel.py
@tomMoral

tomMoral commented Feb 27, 2025 via email

Copy link
Copy Markdown
Contributor

@glemaitre
glemaitre marked this pull request as ready for review February 28, 2025 22:03
@glemaitre

Copy link
Copy Markdown
Contributor Author

So this PR should be ready for review with an example, some documentation, some texts, and the code ;)

@glemaitre

Copy link
Copy Markdown
Contributor Author

OK so we are in trouble with backward compatibility then :(

@ogrisel ogrisel changed the title ENH add a call_context parameter to Parallel ENH add a call_context parameter to Parallel to make it possible to propagate runtime configuration to the workers Mar 3, 2025
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.

2 participants