dapr-ext-workflow-dev 1.17.0.dev90__tar.gz → 1.17.0.dev94__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dapr_ext_workflow_dev-1.17.0.dev90/dapr_ext_workflow_dev.egg-info → dapr_ext_workflow_dev-1.17.0.dev94}/PKG-INFO +1 -1
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/aio/dapr_workflow_client.py +9 -8
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/dapr_workflow_client.py +10 -12
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94/dapr_ext_workflow_dev.egg-info}/PKG-INFO +1 -1
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/tests/test_workflow_client.py +12 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/tests/test_workflow_client_aio.py +14 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/LICENSE +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/README.rst +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/__init__.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/aio/__init__.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/dapr_workflow_context.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/logger/__init__.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/logger/logger.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/logger/options.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/py.typed +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/retry_policy.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/util.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/version.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/workflow_activity_context.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/workflow_context.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/workflow_runtime.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/workflow_state.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr_ext_workflow_dev.egg-info/SOURCES.txt +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr_ext_workflow_dev.egg-info/dependency_links.txt +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr_ext_workflow_dev.egg-info/requires.txt +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr_ext_workflow_dev.egg-info/top_level.txt +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/setup.cfg +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/setup.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/tests/test_dapr_workflow_context.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/tests/test_workflow_activity_context.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/tests/test_workflow_runtime.py +0 -0
- {dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/tests/test_workflow_util.py +0 -0
|
@@ -16,7 +16,7 @@ limitations under the License.
|
|
|
16
16
|
from __future__ import annotations
|
|
17
17
|
|
|
18
18
|
from datetime import datetime
|
|
19
|
-
from typing import Any, Optional, TypeVar
|
|
19
|
+
from typing import Any, Optional, TypeVar, Union
|
|
20
20
|
|
|
21
21
|
import durabletask.internal.orchestrator_service_pb2 as pb
|
|
22
22
|
from dapr.ext.workflow.logger import Logger, LoggerOptions
|
|
@@ -72,7 +72,7 @@ class DaprWorkflowClient:
|
|
|
72
72
|
|
|
73
73
|
async def schedule_new_workflow(
|
|
74
74
|
self,
|
|
75
|
-
workflow: Workflow,
|
|
75
|
+
workflow: Union[Workflow, str],
|
|
76
76
|
*,
|
|
77
77
|
input: Optional[TInput] = None,
|
|
78
78
|
instance_id: Optional[str] = None,
|
|
@@ -82,7 +82,7 @@ class DaprWorkflowClient:
|
|
|
82
82
|
"""Schedules a new workflow instance for execution.
|
|
83
83
|
|
|
84
84
|
Args:
|
|
85
|
-
workflow: The workflow to schedule.
|
|
85
|
+
workflow: The workflow to schedule. Can be a workflow callable or a workflow name string.
|
|
86
86
|
input: The optional input to pass to the scheduled workflow instance. This must be a
|
|
87
87
|
serializable value.
|
|
88
88
|
instance_id: The unique ID of the workflow instance to schedule. If not specified, a
|
|
@@ -96,11 +96,12 @@ class DaprWorkflowClient:
|
|
|
96
96
|
Returns:
|
|
97
97
|
The ID of the scheduled workflow instance.
|
|
98
98
|
"""
|
|
99
|
-
|
|
100
|
-
workflow
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
if isinstance(workflow, str):
|
|
100
|
+
workflow_name = workflow
|
|
101
|
+
elif hasattr(workflow, '_dapr_alternate_name'):
|
|
102
|
+
workflow_name = workflow.__dict__['_dapr_alternate_name']
|
|
103
|
+
else:
|
|
104
|
+
workflow_name = workflow.__name__
|
|
104
105
|
return await self.__obj.schedule_new_orchestration(
|
|
105
106
|
workflow_name,
|
|
106
107
|
input=input,
|
|
@@ -16,7 +16,7 @@ limitations under the License.
|
|
|
16
16
|
from __future__ import annotations
|
|
17
17
|
|
|
18
18
|
from datetime import datetime
|
|
19
|
-
from typing import Any, Optional, TypeVar
|
|
19
|
+
from typing import Any, Optional, TypeVar, Union
|
|
20
20
|
|
|
21
21
|
import durabletask.internal.orchestrator_service_pb2 as pb
|
|
22
22
|
from dapr.ext.workflow.logger import Logger, LoggerOptions
|
|
@@ -75,7 +75,7 @@ class DaprWorkflowClient:
|
|
|
75
75
|
|
|
76
76
|
def schedule_new_workflow(
|
|
77
77
|
self,
|
|
78
|
-
workflow: Workflow,
|
|
78
|
+
workflow: Union[Workflow, str],
|
|
79
79
|
*,
|
|
80
80
|
input: Optional[TInput] = None,
|
|
81
81
|
instance_id: Optional[str] = None,
|
|
@@ -85,7 +85,7 @@ class DaprWorkflowClient:
|
|
|
85
85
|
"""Schedules a new workflow instance for execution.
|
|
86
86
|
|
|
87
87
|
Args:
|
|
88
|
-
workflow: The workflow to schedule.
|
|
88
|
+
workflow: The workflow to schedule. Can be a workflow callable or a workflow name string.
|
|
89
89
|
input: The optional input to pass to the scheduled workflow instance. This must be a
|
|
90
90
|
serializable value.
|
|
91
91
|
instance_id: The unique ID of the workflow instance to schedule. If not specified, a
|
|
@@ -99,16 +99,14 @@ class DaprWorkflowClient:
|
|
|
99
99
|
Returns:
|
|
100
100
|
The ID of the scheduled workflow instance.
|
|
101
101
|
"""
|
|
102
|
-
if
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
reuse_id_policy=reuse_id_policy,
|
|
109
|
-
)
|
|
102
|
+
if isinstance(workflow, str):
|
|
103
|
+
workflow_name = workflow
|
|
104
|
+
elif hasattr(workflow, '_dapr_alternate_name'):
|
|
105
|
+
workflow_name = workflow.__dict__['_dapr_alternate_name']
|
|
106
|
+
else:
|
|
107
|
+
workflow_name = workflow.__name__
|
|
110
108
|
return self.__obj.schedule_new_orchestration(
|
|
111
|
-
|
|
109
|
+
workflow_name,
|
|
112
110
|
input=input,
|
|
113
111
|
instance_id=instance_id,
|
|
114
112
|
start_at=start_at,
|
|
@@ -47,6 +47,9 @@ class SimulatedRpcError(RpcError):
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
class FakeTaskHubGrpcClient:
|
|
50
|
+
def __init__(self):
|
|
51
|
+
self.last_scheduled_workflow_name = None
|
|
52
|
+
|
|
50
53
|
def schedule_new_orchestration(
|
|
51
54
|
self,
|
|
52
55
|
workflow,
|
|
@@ -55,6 +58,7 @@ class FakeTaskHubGrpcClient:
|
|
|
55
58
|
start_at,
|
|
56
59
|
reuse_id_policy: Union[pb.OrchestrationIdReusePolicy, None] = None,
|
|
57
60
|
):
|
|
61
|
+
self.last_scheduled_workflow_name = workflow
|
|
58
62
|
return mock_schedule_result
|
|
59
63
|
|
|
60
64
|
def get_orchestration_state(self, instance_id, fetch_payloads):
|
|
@@ -112,6 +116,14 @@ class WorkflowClientTest(unittest.TestCase):
|
|
|
112
116
|
def mock_client_wf(ctx: DaprWorkflowContext, input):
|
|
113
117
|
print(f'{input}')
|
|
114
118
|
|
|
119
|
+
def test_schedule_workflow_by_name_string(self):
|
|
120
|
+
fake_client = FakeTaskHubGrpcClient()
|
|
121
|
+
with mock.patch('durabletask.client.TaskHubGrpcClient', return_value=fake_client):
|
|
122
|
+
wfClient = DaprWorkflowClient()
|
|
123
|
+
result = wfClient.schedule_new_workflow(workflow='my_registered_workflow', input='data')
|
|
124
|
+
assert result == mock_schedule_result
|
|
125
|
+
assert fake_client.last_scheduled_workflow_name == 'my_registered_workflow'
|
|
126
|
+
|
|
115
127
|
def test_client_functions(self):
|
|
116
128
|
with mock.patch(
|
|
117
129
|
'durabletask.client.TaskHubGrpcClient', return_value=FakeTaskHubGrpcClient()
|
|
@@ -47,6 +47,9 @@ class SimulatedAioRpcError(AioRpcError):
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
class FakeAsyncTaskHubGrpcClient:
|
|
50
|
+
def __init__(self):
|
|
51
|
+
self.last_scheduled_workflow_name = None
|
|
52
|
+
|
|
50
53
|
async def schedule_new_orchestration(
|
|
51
54
|
self,
|
|
52
55
|
workflow,
|
|
@@ -56,6 +59,7 @@ class FakeAsyncTaskHubGrpcClient:
|
|
|
56
59
|
start_at,
|
|
57
60
|
reuse_id_policy: Union[pb.OrchestrationIdReusePolicy, None] = None,
|
|
58
61
|
):
|
|
62
|
+
self.last_scheduled_workflow_name = workflow
|
|
59
63
|
return mock_schedule_result
|
|
60
64
|
|
|
61
65
|
async def get_orchestration_state(self, instance_id, *, fetch_payloads):
|
|
@@ -113,6 +117,16 @@ class WorkflowClientAioTest(unittest.IsolatedAsyncioTestCase):
|
|
|
113
117
|
def mock_client_wf(ctx: DaprWorkflowContext, input):
|
|
114
118
|
print(f'{input}')
|
|
115
119
|
|
|
120
|
+
async def test_schedule_workflow_by_name_string(self):
|
|
121
|
+
fake_client = FakeAsyncTaskHubGrpcClient()
|
|
122
|
+
with mock.patch('durabletask.aio.client.AsyncTaskHubGrpcClient', return_value=fake_client):
|
|
123
|
+
wfClient = DaprWorkflowClient()
|
|
124
|
+
result = await wfClient.schedule_new_workflow(
|
|
125
|
+
workflow='my_registered_workflow', input='data'
|
|
126
|
+
)
|
|
127
|
+
assert result == mock_schedule_result
|
|
128
|
+
assert fake_client.last_scheduled_workflow_name == 'my_registered_workflow'
|
|
129
|
+
|
|
116
130
|
async def test_client_functions(self):
|
|
117
131
|
with mock.patch(
|
|
118
132
|
'durabletask.aio.client.AsyncTaskHubGrpcClient',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
{dapr_ext_workflow_dev-1.17.0.dev90 → dapr_ext_workflow_dev-1.17.0.dev94}/dapr/ext/workflow/util.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|