You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
history_export: resolve activity dependencies per invocation
Retire the process-global `bind_context` from the history-export
extension in favor of a per-invocation resolver/factory pattern so any
hosting model (including multi-process ones like Azure Functions) can
supply the export client and writer without a process-global.
Core:
- Add `HistoryExportContextResolver` plus pure activity bodies
`run_list_terminal_instances`/`run_export_instance_history` that
take an explicit `HistoryExportContext`.
- Add `build_activities(resolver)` factory and change
`register(worker, resolver)` to register resolver-bound activities.
- Remove `bind_context`/`clear_context`/`_require_context` and the
module-global context. `ExportHistoryClient.register_worker` now
captures a context in the activity closures instead of installing a
global.
Azure Functions adapter:
- Drop the `bind_context` shim; build the `HistoryExportContext` from
the per-invocation injected client (cached per process) and call the
core bodies explicitly.
Fixes#182
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f91b67b0-d282-4744-b744-4b2a8e1294be
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
10
10
ADDED
11
11
12
12
- Added `FailureDetails.is_caused_by()` to check whether a task failure was caused by a given exception type, mirroring .NET's `TaskFailureDetails.IsCausedBy<T>()` and Java's `FailureDetails.isCausedBy()`. Passing an exception type performs a base-type-aware match (a failure caused by a subclass matches its base type) against exception classes already imported in the process; passing a string matches by qualified or unqualified name.
13
+
- Added a per-invocation dependency-resolution API to `durabletask.extensions.history_export` so any hosting model can supply the export client and writer without a process-global. The export activities now resolve their `HistoryExportContext` from a resolver invoked once per activity execution; new public building blocks are the `HistoryExportContextResolver` type, the pure activity bodies `run_list_terminal_instances(context, input)` and `run_export_instance_history(context, input)`, and the `build_activities(resolver)` factory. This lets host-driven, multi-process models (such as Azure Functions, where the process that starts an export job is not the worker that runs an export activity) inject dependencies lazily per invocation.
13
14
14
15
CHANGED
15
16
16
17
-**Breaking:**`FailureDetails.error_type` — and the `errorType` value sent over the wire — is now the fully-qualified type name (`module.ClassName`, e.g. `builtins.ValueError`, `durabletask.task.TaskFailedError`) instead of the bare class name, matching the .NET and Java SDKs. Code that compared `error_type` against a bare name (for example `== "ValueError"`) must be updated to the qualified name or, preferably, switched to `FailureDetails.is_caused_by()`. Because this value is persisted and crosses the orchestration boundary, failures produced by older workers may still carry a bare name; `is_caused_by()` accepts both.
18
+
-**Breaking:** Retired the process-global history-export context. `durabletask.extensions.history_export.bind_context()` and `clear_context()` have been removed; the export activities now resolve their `HistoryExportContext` per invocation via a resolver captured at registration. `ExportHistoryClient.register_worker()` continues to wire this up automatically, so most callers are unaffected. Code that called `bind_context(HistoryExportContext(client, writer))` directly should instead register the activities with `durabletask.extensions.history_export.activities.register(worker, lambda: HistoryExportContext(client, writer))` (or a lazier resolver), or use `ExportHistoryClient.register_worker()`.
0 commit comments