[Question] Had some queries around the context propagation example
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- documentation
Research direction
Start with context_propagation/README.md and review the linked Temporal Python SDK issue #263. Determine whether ContextVar.reset() changes behavior for thread-pool activities and concurrent workflows, then document the supported guidance and any conditions where resetting matters.
Written by the indexing model from the issue text.
Description
Hi, was just implementing a context propagation interceptor based on this sample: https://github.com/temporalio/samples-python/blob/main/context_propagation/README.md
After a bit of experimentation, it seems like the the contextvar value is automatically restored to the previous value during multiple concurrent workflow runs and even after an activity finishes executing (if the var was updated inside the activity).
I was wondering if the ContextVar.reset() usage in the sample is redundant? or are there scenarios where it might have an effect?
I'm using a thread pool executor for my worker, so perhaps thats why it seems like ContextVar.reset() does not do anything? https://github.com/temporalio/sdk-python/issues/263
Would it be safe to remove the resetting part when using a thread pool executor for activity tasks? And for workflows in general if I don't want the context vars state to leak between them?
- Dominant language
- Python
- Stars
- 367
- Forks
- 121
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 11
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from temporalio/samples-python
-
enhancement
temporalio/samples-python#254 · 1 comment · 1 assignee ·
-
enhancement
temporalio/samples-python#253 · 1 assignee ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
temporalio/samples-python#231 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
temporalio/samples-python#192 · 2 comments ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
temporalio/samples-python#191 ·
All issues in temporalio/samples-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100