Skip to content

Commit e24b474

Browse files
committed
- Upgraded durable-task-python
- Updated simple-aio to show examples of async and sync activities Signed-off-by: Patrick Assuied <[email protected]>
1 parent 02fd096 commit e24b474

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

examples/workflow/simple_aio.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2023 The Dapr Authors
2+
# Copyright 2025 The Dapr Authors
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
@@ -77,11 +77,13 @@ def hello_world_wf(ctx: wf.DaprWorkflowContext, wf_input):
7777
async def hello_act(ctx: wf.WorkflowActivityContext, wf_input):
7878
global counter
7979
counter += wf_input
80+
await asyncio.sleep(0.1) # simulates async work.
8081
print(f'New counter value is: {counter}!', flush=True)
8182

8283

84+
# an activity can also be left synchronous.
8385
@wfr.activity(name='hello_retryable_act')
84-
async def hello_retryable_act(ctx: wf.WorkflowActivityContext):
86+
def hello_retryable_act(ctx: wf.WorkflowActivityContext):
8587
global retry_count
8688
if (retry_count % 2) == 0:
8789
print(f'Retry count value is: {retry_count}!', flush=True)

ext/dapr-ext-workflow/dapr/ext/workflow/aio/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# -*- coding: utf-8 -*-
22

3+
"""
4+
Copyright 2025 The Dapr Authors
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
316
from .dapr_workflow_client import DaprWorkflowClient
417
from .workflow_runtime import WorkflowRuntime
518

ext/dapr-ext-workflow/dapr/ext/workflow/aio/workflow_runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
"""
4-
Copyright 2023 The Dapr Authors
4+
Copyright 2025 The Dapr Authors
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
77
You may obtain a copy of the License at

ext/dapr-ext-workflow/setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ python_requires = >=3.9
2424
packages = find_namespace:
2525
include_package_data = True
2626
install_requires =
27-
dapr >= 1.16.0.dev
28-
durabletask-dapr >= 0.2.0a12
27+
dapr >= 1.16.1rc1
28+
durabletask-dapr >= 0.2.0a13
2929
grpcio >= 1.62
3030

3131
[options.packages.find]

ext/dapr-ext-workflow/tests/aio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
"""
4-
Copyright 2023 The Dapr Authors
4+
Copyright 2025 The Dapr Authors
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
77
You may obtain a copy of the License at

ext/dapr-ext-workflow/tests/aio/test_workflow_runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
"""
4-
Copyright 2023 The Dapr Authors
4+
Copyright 2025 The Dapr Authors
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
77
You may obtain a copy of the License at

0 commit comments

Comments
 (0)