feat: enable wf to start via just name like go sdk#957
feat: enable wf to start via just name like go sdk#957
Conversation
Signed-off-by: Samantha Coyle <sam@diagrid.io>
There was a problem hiding this comment.
Pull request overview
This PR updates the Dapr Workflow Python SDK client to allow starting/scheduling workflows by passing a workflow name string (in addition to passing a workflow callable), aligning the scheduling ergonomics with the Go SDK and enabling simpler cross-agent invocation.
Changes:
- Extend
schedule_new_workflow(sync + aio) to acceptworkflow: Union[Workflow, str]and resolve the workflow name appropriately. - Update docstrings to document the new string-name option.
- Add unit tests (sync + aio) validating scheduling by workflow name string and that the underlying durabletask client receives the string.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py |
Accepts a workflow name string and forwards the resolved name into schedule_new_orchestration. |
ext/dapr-ext-workflow/dapr/ext/workflow/aio/dapr_workflow_client.py |
Async equivalent of string-name workflow scheduling. |
ext/dapr-ext-workflow/tests/test_workflow_client.py |
Adds a sync test to ensure scheduling by string name is forwarded correctly. |
ext/dapr-ext-workflow/tests/test_workflow_client_aio.py |
Adds an async test to ensure scheduling by string name is forwarded correctly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #957 +/- ##
==========================================
+ Coverage 86.63% 89.01% +2.38%
==========================================
Files 84 103 +19
Lines 4473 7367 +2894
==========================================
+ Hits 3875 6558 +2683
- Misses 598 809 +211 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This PR makes python sdk closer to go sdk in the fact that we can schedule callable workflows as is, in addition to how the go sdk does it via string name for a workflow. see https://github.com/dapr/go-sdk/blob/ff4e5eb454cb837c77fbe5a6648c66d8fa73859f/examples/workflow-parallel/main.go#L46
We need this for dapr agents for users to call to other agents easily.
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: