Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

asyncio split part 2#32

Closed
filintod wants to merge 11 commits intodapr:maindapr/durabletask-python:mainfrom
filintod:filinto/asyncio-p2filintod/durabletask-python:filinto/asyncio-p2Copy head branch name to clipboard
Closed

asyncio split part 2#32
filintod wants to merge 11 commits intodapr:maindapr/durabletask-python:mainfrom
filintod:filinto/asyncio-p2filintod/durabletask-python:filinto/asyncio-p2Copy head branch name to clipboard

Conversation

@filintod
Copy link

@filintod filintod commented Nov 8, 2025

No description provided.

@filintod filintod force-pushed the filinto/asyncio-p2 branch 2 times, most recently from b20de61 to 27068dc Compare November 10, 2025 13:56
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
tox.ini Outdated Show resolved Hide resolved
.vscode/settings.json Show resolved Hide resolved
- `DAPR_GRPC_ENDPOINT` - Full endpoint (e.g., `localhost:4001`, `grpcs://host:443`)
- `DAPR_GRPC_HOST` (or `DAPR_RUNTIME_HOST`) and `DAPR_GRPC_PORT` - Host and port separately

Example (common ports: 4001 for DurableTask-Go emulator, 50001 for Dapr sidecar):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the 4001 supposed to be for this repo, durabletask python? or is there some emulator thing somewhere?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is historical, but 4001 was the default before. also look at durabletask-go https://github.com/dapr/durabletask-go (same 4001)

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated

Optional sandbox mode (`best_effort` or `strict`) patches `asyncio.sleep`, `random`, `uuid.uuid4`, and `time.time` within the workflow step to deterministic equivalents. This is best-effort and not a correctness guarantee.

In `strict` mode, `asyncio.create_task` is blocked inside workflows to preserve determinism and will raise a `SandboxViolationError` if used.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see you say to presever determinism, but i still dont understand the why here. can you expand the explanation pls

README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
tests/aio/test_asyncio_enhanced_additions.py Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
durabletask/worker.py Outdated Show resolved Hide resolved
durabletask/worker.py Show resolved Hide resolved
durabletask/worker.py Outdated Show resolved Hide resolved
durabletask/worker.py Show resolved Hide resolved
durabletask/client.py Outdated Show resolved Hide resolved
Comment on lines +60 to +63
class NonDeterminismWarning(UserWarning):
"""Warning raised when non-deterministic functions are detected in workflows."""

pass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this used if it has pass in it? or its used and used through the inheritance?

durabletask/aio/errors.py Show resolved Hide resolved
durabletask/aio/ASYNCIO_ENHANCEMENTS.md Show resolved Hide resolved
durabletask/aio/ASYNCIO_ENHANCEMENTS.md Outdated Show resolved Hide resolved
durabletask/aio/ASYNCIO_ENHANCEMENTS.md Show resolved Hide resolved
durabletask/aio/ASYNCIO_ENHANCEMENTS.md Outdated Show resolved Hide resolved
durabletask/aio/ASYNCIO_ENHANCEMENTS.md Show resolved Hide resolved
durabletask/aio/ASYNCIO_ENHANCEMENTS.md Show resolved Hide resolved
durabletask/aio/ASYNCIO_ENHANCEMENTS.md Show resolved Hide resolved
durabletask/aio/ASYNCIO_ENHANCEMENTS.md Outdated Show resolved Hide resolved
Comment on lines +183 to +187
python your_workflow.py

# Production mode (no warnings, optimal performance)
unset DAPR_WF_DEBUG
python your_workflow.py
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont these need to be wrapped in a dapr run cmd then if they req a sidecar?

durabletask/aio/ASYNCIO_ENHANCEMENTS.md Outdated Show resolved Hide resolved
@@ -0,0 +1,301 @@
# Durable Task AsyncIO Internals

This document explains how the AsyncIO implementation in this repository integrates with the existing generator‑based Durable Task runtime. It covers the coroutine→generator bridge, awaitable design, sandboxing and non‑determinism detection, error/cancellation semantics, debugging, and guidance for extending the system.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the coroutine-> generator bridge the sandbox thing? or different? what does non-determinsitm detection mean? and if triggered then do we err?

durabletask/aio/ASYNCIO_INTERNALS.md Show resolved Hide resolved
Key modules:
- `durabletask/aio/context.py` — Async workflow context and deterministic utilities
- `durabletask/aio/driver.py` — Coroutine→generator bridge
- `durabletask/aio/sandbox.py` — Scoped patching and non‑determinism detection
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth separating the non-determinism detection stuff then into a diff file? or put the non-determinism stuff with the deterministic utilities from context.py?

durabletask/aio/ASYNCIO_INTERNALS.md Show resolved Hide resolved

### Coroutine→Generator Bridge

Async orchestrators are authored as `async def` but executed by Durable Task as generators that yield `durabletask.task.Task` (or composite) instances. The bridge implements a driver that manually steps a coroutine and converts each `await` into a yielded Durable Task operation.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you pls add in how this is the translation of async world to safe sync workflow generator world pls

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and is it the case that each activity yields its own coroutine and then the workflow is in a main coroutine - just to make sure im tracking 🙏

durabletask/aio/ASYNCIO_INTERNALS.md Show resolved Hide resolved
Concurrency:
- `when_all([...])` returns an awaitable that completes with a list of results
- `when_any([...])` returns an awaitable that completes with the first completed child
- `when_any_with_result([...])` returns `(index, result)`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these just docs on existing methods? or did you add things for when_all? it not then can we pls rm?

Comment on lines +68 to +69
- Operation history when debug is enabled (`DAPR_WF_DEBUG=true` or `DT_DEBUG=true`)
- `get_debug_info()` to inspect state for diagnostics
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably can rm these pls bc i think setting log level is sufficient already right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the name is not correct, this is more like getting a snapshot of the context info but mostly for debugging/exception

filintod and others added 4 commits November 23, 2025 16:48
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
…RMINISTIC_DETECTION

Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
Co-authored-by: Sam <sam@diagrid.io>
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
@filintod filintod marked this pull request as ready for review November 24, 2025 05:42
@filintod filintod requested a review from a team as a code owner November 24, 2025 05:42
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
@filintod filintod requested a review from sicoyle November 24, 2025 05:44
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
@CasperGN
Copy link

@filintod this PR is just too massive to even get a grasp on. I suggest it to be split into substantially smaller bite sizes and then implemented in iterations.
There is no way to review and test this with reasonable confidence.

@sicoyle, @acroca if you agree then I think we should close this one and let it arrive in smaller chunks

@acroca
Copy link
Member

acroca commented Jan 8, 2026

I agree.

@acroca acroca closed this Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.