Skip to content

[Feature Request] Populate contextvars for threaded activities #263

Closed
@cretz

Description

@cretz

Is your feature request related to a problem? Please describe.

Currently we are calling https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor but we are not propagating the contextvars.

Describe the solution you'd like

Since there is no way with run_in_executor and we don't want to use to_thread as suggested at python/cpython#78195 because it doesn't use a custom executor, we need to just populate the context ourselves. This of course won't work with process pool executor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions