Skip to content

[Feature Request] Support InterpreterPoolExecutor from py3.14 #1154

@blueraft

Description

@blueraft

Python 3.14 adds InterpreterPoolExecutor, a subclass of ThreadPoolExecutor that runs tasks in isolated subinterpreters.

The Temporal Python SDK appears to assume ThreadPoolExecutor-like behavior in worker/_activity.py, which doesn’t hold for InterpreterPoolExecutor. Using it as an activity executor leads to the following errors:

concurrent.interpreters.NotShareableError: (Queue(2), <built-in method run of _contextvars.Context object at 0x1015fec00>, (<function _execute_sync_activity at 0x1014171c0>, Info(activity_id='61', activity_type='task', attempt=3, current_attempt_scheduled_time=datetime.datetime(2025, 10, 13, 9, 32, 51, 324811, tzinfo=datetime.timezone.utc), heartbeat_details=[], heartbeat_timeout=None, is_local=False, schedule_to_close_timeout=None, scheduled_time=datetime.datetime(2025, 10, 13, 9, 32, 47, 122424, tzinfo=datetime.timezone.utc), start_to_close_timeout=datetime.timedelta(seconds=36000), started_time=datetime.datetime(2025, 10, 13, 9, 32, 51, 692224, tzinfo=datetime.timezone.utc), task_queue='hello-task-queue', task_token=b'\n$0199c8e3-3716-7223-b18b-3a720150440f\x1231906eac1-8e34-4119-b7d5-0da5e8ffefd4-hello-workflow\x1a$0199dcea-4e2f-7cb2-bf9b-ef9859498ab6 A(\x032\x0261B\x04taskJ\x08\x08\x01\x10\x93\xb4A\x18\x01', workflow_id='1906eac1-8e34-4119-b7d5-0da5e8ffefd4-hello-workflow', workflow_namespace='default', workflow_run_id='0199dcea-4e2f-7cb2-bf9b-ef9859498ab6', workflow_type='GreetingWorkflow', priority=Priority(priority_key=None, fairness_key=None, fairness_weight=None), retry_policy=RetryPolicy(initial_interval=datetime.timedelta(seconds=1), backoff_coefficient=2.0, maximum_interval=datetime.timedelta(seconds=100), maximum_attempts=0, non_retryable_error_types=None)), <function _ActivityInboundImpl.execute_activity.<locals>.<lambda> at 0x1016381a0>, <temporalio.worker._activity._ThreadExceptionRaiser object at 0x10161df60>, <threading.Event at 0x101620fb0: unset>, <threading.Event at 0x10152d810: unset>, <temporalio.converter.DefaultPayloadConverter object at 0x1010e4c20>, <temporalio.common._NoopMetricMeter object at 0x100d9be00>, _ActivityCancellationDetailsHolder(details=None), <function task at 0x101529430>), {}) does not support cross-interpreter data

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