Skip to content

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 <[email protected]>
Signed-off-by: Filinto Duran <[email protected]>
Signed-off-by: Filinto Duran <[email protected]>
Signed-off-by: Filinto Duran <[email protected]>
- `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

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

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?

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?

@@ -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?

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?


### 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 🙏

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 <[email protected]>
Signed-off-by: Filinto Duran <[email protected]>
@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 <[email protected]>
Signed-off-by: Filinto Duran <[email protected]>
@filintod filintod requested a review from sicoyle November 24, 2025 05:44
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.

2 participants