[Question] Had some queries around the context propagation example

Offen
#176 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Dokumentation
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
documentation

Rechercherichtung

Beginnen Sie mit context_propagation/README.md und prüfen Sie das verlinkte Temporal Python SDK issue #263. Ermitteln Sie, ob ContextVar.reset() das Verhalten von Aktivitäten im Thread-Pool und nebenläufigen Workflows verändert, und dokumentieren Sie die unterstützten Empfehlungen sowie alle Bedingungen, unter denen das Zurücksetzen relevant ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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?

Vorherrschende Sprache
Python
Sterne
367
Forks
121
Ø Merge
3 T. 20 Std.
Gemergte PRs (30 T.)
11

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus temporalio/samples-python

Alle Issues in temporalio/samples-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.