Skip to content

Commit fc59e38

Browse files
andystaplesCopilot
andcommitted
Disclose the generator first-yield check and make async migration snippets runnable
Add a core CHANGED entry for generator orchestrators whose first yield is not a Task, and drop the unchanged-generator claims from the changelogs. The async gather and race migration snippets now include their imports, app, and orchestration trigger. Co-authored-by: Copilot App <[email protected]>
1 parent 66fb372 commit fc59e38

4 files changed

Lines changed: 36 additions & 9 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ ADDED
1313
whose durable operations are cold coroutines, support durable asyncio timers
1414
and ordered composition such as `asyncio.gather`, `asyncio.TaskGroup`, and
1515
`asyncio.timeout`, and offer event waits with owned cancellation and timeouts.
16-
Generator orchestrators are unchanged; `as_task_context()` and `Task.wait()`
17-
interoperate with their eager durable handles. Pass `return_type` to type and
18-
reconstruct async sub-orchestration results. `asyncio.wait` and
19-
`asyncio.as_completed` are not supported.
16+
`as_task_context()` and `Task.wait()` interoperate with eager durable task
17+
handles. Pass `return_type` to type and reconstruct async sub-orchestration
18+
results. `asyncio.wait` and `asyncio.as_completed` are not supported.
2019

2120
> [!WARNING]
2221
> Async cleanup can run at every dispatch, including suspension; it is not
@@ -26,6 +25,15 @@ reconstruct async sub-orchestration results. `asyncio.wait` and
2625
> [async contract](docs/async-orchestrators.md) for supported operations and
2726
> replay and upgrade guidance.
2827
28+
CHANGED
29+
30+
- A generator orchestrator whose first `yield` is not a `durabletask.Task`, such
31+
as a bare `yield` or `yield [task]`, now fails on its first dispatch with a
32+
`TypeError` ("The orchestrator generator yielded a non-Task object").
33+
Previously a bare first `yield` left the instance pending indefinitely, and a
34+
non-Task first yield scheduled its work and then failed later with an
35+
`AttributeError`.
36+
2937
FIXED
3038

3139
- Activity and sub-orchestration `retry_timeout` decisions now use replay-safe

‎azure-functions-durable/CHANGELOG.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ a future major version, which may introduce replay-breaking changes.
1414
- Added `async def` orchestrators with the core two-argument shape,
1515
`async def orchestrator(ctx: task.AsyncOrchestrationContext, input)`, and
1616
`df.call_http()` for durable HTTP requests from durabletask orchestration
17-
contexts. Single-parameter `async def` orchestrators are not supported and
18-
raise `TypeError` when registered. Generator orchestrators are unchanged.
17+
contexts. `async def` orchestrators with fewer than two positional parameters
18+
are not supported and raise `TypeError` when registered.
1919
Requires a `durabletask` release with async orchestrator support. See the
2020
[async contract](../docs/async-orchestrators.md) for dispatch cleanup and
2121
replay/upgrade precautions.

‎azure-functions-durable/MIGRATION_GUIDE.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ For fan-out in an async orchestrator, use ordered `asyncio.gather` or
178178
`asyncio.TaskGroup`:
179179

180180
```python
181+
import asyncio
182+
183+
import azure.durable_functions as df
184+
from durabletask import task
185+
186+
app = df.DFApp()
187+
188+
189+
@app.orchestration_trigger(context_name="context")
181190
async def greetings(ctx: task.AsyncOrchestrationContext, names: list[str]) -> list[str]:
182191
return list(await asyncio.gather(*(
183192
ctx.call_activity("say_hello", input=name, return_type=str)
@@ -195,6 +204,16 @@ For races, obtain eager handles through `ctx.as_task_context()` and pass them to
195204
`task.when_any`, which returns the identical winning handle:
196205

197206
```python
207+
from datetime import timedelta
208+
from typing import Any
209+
210+
import azure.durable_functions as df
211+
from durabletask import task
212+
213+
app = df.DFApp()
214+
215+
216+
@app.orchestration_trigger(context_name="context")
198217
async def approval(ctx: task.AsyncOrchestrationContext, _: Any) -> bool:
199218
handles = ctx.as_task_context()
200219
approved = handles.wait_for_external_event("approval", data_type=bool)

‎durabletask-azuremanaged/CHANGELOG.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ ADDED
1111

1212
- With the corresponding core SDK, `DurableTaskSchedulerWorker` accepts
1313
`async def` orchestrators with an automatically supplied async context, cold
14-
durable operations, and supported asyncio composition. Generator orchestrators
15-
retain their existing behavior. Event waits support owned cancellation and
16-
timeouts; remote operations are not cancelled by local waiter cancellation.
14+
durable operations, and supported asyncio composition. Event waits support
15+
owned cancellation and timeouts; remote operations are not cancelled by local
16+
waiter cancellation.
1717
See the [async contract](../docs/async-orchestrators.md) for dispatch cleanup
1818
and replay/upgrade precautions. Requires a `durabletask` release with async
1919
orchestrator support.

0 commit comments

Comments
 (0)