Skip to content

Conversation

@filintod
Copy link
Contributor

@filintod filintod commented Aug 20, 2025

Description

Make it possible to use python workflow that manages code using asyncio to retrofit code that is already written as async/await.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@filintod filintod changed the title initial asyncio implemenation after durable task asyncio work initial asyncio implementation after durable task asyncio work Aug 20, 2025
These examples mirror `examples/workflow/` but author orchestrators with `async def` using the
async workflow APIs. Activities remain regular functions unless noted.

How to run:
Copy link
Contributor

Choose a reason for hiding this comment

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

pls add a venv reference in here too

Comment on lines 1 to 11
# dapr-ext-workflow-dev>=1.15.0.dev
# dapr-dev>=1.15.0.dev

# local development: install local packages in editable mode

# if using dev version of durabletask-python
-e ../../../durabletask-python

# if using dev version of dapr-ext-workflow
-e ../../ext/dapr-ext-workflow
-e ../..
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# dapr-ext-workflow-dev>=1.15.0.dev
# dapr-dev>=1.15.0.dev
# local development: install local packages in editable mode
# if using dev version of durabletask-python
-e ../../../durabletask-python
# if using dev version of dapr-ext-workflow
-e ../../ext/dapr-ext-workflow
-e ../..
dapr-ext-workflow-dev>=1.15.0.dev
dapr-dev>=1.15.0.dev
# local development: install local packages in editable mode
# if using dev version of durabletask-python
# -e ../../../durabletask-python
# if using dev version of dapr-ext-workflow
# -e ../../ext/dapr-ext-workflow
# -e ../..

@filintod filintod force-pushed the filinto/asyncio branch 2 times, most recently from 469c2e4 to 12269e7 Compare November 20, 2025 06:35
@filintod filintod marked this pull request as ready for review November 20, 2025 06:36
@filintod filintod requested review from a team as code owners November 20, 2025 06:36
print(f'Child workflow returned {result_4}')

# Event vs timeout using when_any
event_1 = ctx.wait_for_external_event(event_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't these become async as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the runtime and the client are separate entities, as you have seen in your PR, so the client can be async or not

@passuied
Copy link
Contributor

@filintod looking at the examples you've added I think you would benefit from either waiting for my PR to be merged or merging that PR into your branch.
Unfortunately mixing sync and async has been leading to deadlocks/blocked thread when we tried to use the sync WorkflowClient in async methods... We had to use run_in_threadpool() to avoid this issue...

@filintod
Copy link
Contributor Author

filintod commented Dec 2, 2025

@passuied I'll wait for your PR to be merged, it complements this

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