Skip to content

Commit 7351c4e

Browse files
committed
Add sample to READMEs, update sample to include list_activities and count_activities
1 parent 53e1b79 commit 7351c4e

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Some examples require extra dependencies. See each sample's directory for specif
5555
* [hello_search_attributes](hello/hello_search_attributes.py) - Start workflow with search attributes then change
5656
while running.
5757
* [hello_signal](hello/hello_signal.py) - Send signals to a workflow.
58+
* [hello standalone activity](hello/hello_standalone_activity.py) - Execute an activity from outside of a workflow.
59+
* [hello update](hello/hello_update.py) - Send a request to and a response from a client to a workflow execution.
5860
<!-- Keep this list in alphabetical order -->
5961
* [activity_worker](activity_worker) - Use Python activities from a workflow in another language.
6062
* [batch_sliding_window](batch_sliding_window) - Batch processing with a sliding window of child workflows.

hello/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ Replace `hello/hello_activity.py` in the command with any other example filename
4444
* [hello_search_attributes](hello_search_attributes.py) - Start workflow with search attributes then change while
4545
running.
4646
* [hello_signal](hello_signal.py) - Send signals to a workflow.
47-
* [hello_update](hello_update.py) - Send a request to and a response from a client to a workflow execution.
47+
* [hello standalone activity](hello_standalone_activity.py) - Execute an activity from outside of a workflow.
48+
* [hello_update](hello_update.py) - **Send a request to and a response from a client to a workflow execution.**
4849

4950
Note: To enable the workflow update, set the `frontend.enableUpdateWorkflowExecution` dynamic config value to true.
5051

hello/hello_standalone_activity.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ async def my_client_code(client: Client):
3838
)
3939
print(f"Activity result: {result}")
4040

41+
activities = client.list_activities(
42+
query="TaskQueue = 'hello-standalone-activity-task-queue'"
43+
)
44+
print("ListActivity results:")
45+
async for info in activities:
46+
print(f"\tActivityID: {info.activity_id}, Type: {info.activity_type}, Status: {info.status}")
47+
48+
count_result = await client.count_activities(
49+
query="TaskQueue = 'hello-standalone-activity-task-queue'"
50+
)
51+
print(f"Total activities: {count_result.count}")
52+
4153

4254
async def main():
4355
# Uncomment the lines below to see logging output

0 commit comments

Comments
 (0)