Get from PyPI

Highlights

Safe Eviction

The internal eviction logic has been overhauled to make sure that asyncio tasks are completed before a workflow is removed from the cache and garbage collected. For all properly running workflows this should not cause any issues. However, workflows that may have been developed in invalid ways in the past could have a problem being evicted from cache and will log as such. Users should keep an eye out for logs when upgrading to this version.

Experimental Workflow Failure Type Customization

When a workflow raises an exception that wasn't ApplicationErroror bubbled from a Temporal call (e.g. activity failure), it would be a "task failure" which puts the workflow in a suspended state retrying the task until a code fix is deployed. An experimental feature is now available that lets users set which exception types should instead fail the workflow instead of suspending it. Users can now set the per-workflow failure_exception_typeson the @workflow.defndecorator or set the worker-level workflow_failure_exception_typeswhen creating the Worker. If an exception extends from one of these when raised, it will fail the workflow when raised.

HTTP CONNECT Proxy Support

Python clients now officially support HTTP CONNECT proxies. The http_connect_proxy_configargument can now be set when connecting a Client.

Worker Client Replacement

Workers can now have the client they use replaced without shutting down the worker. The clientproperty on the Workercan be set to a different connected client. This is useful for users that need to change options like mTLS client certificate without worker downtime. The worker will not interrupt any polling calls but will start using the new client for subsequent calls.

API Key Client Option

If you use API keys in your Temporal server (i.e. Bearertokens on Authorizationheaders), you can now set api_keywhen connecting a Clientor set the api_keyproperty on an existing client to update it.

Floats and Durations in Metrics

Users using metric_meter()directly to create metrics (off of runtime, activity, or workflow) can now create float-based histograms and gauges, and duration-based histograms. Similarly users using MetricBufferto retrieve metrics can say how they want to retrieve durations (float seconds, int milliseconds, or timedelta). A durations_as_secondsoption was added to telemetry options for users that prefer seconds as float-based durations to OpenTelemetry and Prometheus instead of the default of integer milliseconds.

Counting Workflows

A new count_workflowscall has been added to the Clientthat takes the same query as list_workflowsbut is optimized just to perform counts.

💥 Activity/Workflow extraon LogRecordChanged

Activity logs and workflow logs used to set activity_infoand workflow_infoon LogRecordrespectively as the full info dataclasses by default. This was not usable by many third-party logging tools that can only work with dicts and not dataclasses. Therefore the default was changed to set temporal_activityand temporal_workflowon the respective log records to dicts of commonly needed information. temporalio.activity.logger.full_activity_info_on_extraand/or temporalio.workflow.logger.full_workflow_info_on_extracan be set to Trueto put those info entries back on extra.

This only affects those using advanced log handlers that leverage contextual state. The log messages themselves are unaffected.

Specific Changes

2024-03-04 - 477aa31 - Fix execute_child_workflow apidoc (#483) 2024-03-13 - f3d1b85 - API key client option (#486) 2024-03-26 - 36fe961 - Remove experimental flag from start_delay (#492) 2024-04-01 - 13d18ca - Update core and add durations-as-seconds metric option (#498) 2024-04-02 - b07e75e - Change default "extra" contents of activity/workflow logs (#490) 2024-04-05 - 1001653 - HTTP CONNECT proxy support (#501) 2024-04-05 - 466da16 - Safe Eviction (#499) 2024-04-12 - b45447e - Add macOS ARM runner (#506) 2024-04-12 - cf4c7cb - Ensure extra data on task fail logs (#502) 2024-04-18 - 50c2033 - Support float and duration metrics (#508) 2024-04-19 - ecd703d - Add Client.count_workflows (#510) 2024-04-30 - 0bb94f8 - Ability for certain task failure types to fail workflow (#516) 2024-05-03 - 0687151 - Worker client replacement (#517)