Skip to content

Commit bc2ffaa

Browse files
committed
Add an equal number of thread-blocking workflows
1 parent fb3dccd commit bc2ffaa

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

scripts/run_bench.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ async def bench_activity(name: str) -> str:
3131
return f"Hello, {name}!"
3232

3333

34+
@workflow.defn
35+
class DeadlockInterruptibleWorkflow:
36+
@workflow.run
37+
async def run(self) -> None:
38+
# Infinite loop, which is interruptible via PyThreadState_SetAsyncExc
39+
while True:
40+
pass
41+
42+
3443
async def main():
3544
logging.basicConfig(
3645
format="%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s",
@@ -93,6 +102,13 @@ async def report_mem():
93102
task_queue=task_queue,
94103
)
95104
for i in range(args.workflow_count)
105+
] + [
106+
await env.client.start_workflow(
107+
DeadlockInterruptibleWorkflow.run,
108+
id=f"deadlock-interruptible-workflow-{i}-{uuid.uuid4()}",
109+
task_queue=task_queue,
110+
)
111+
for i in range(args.workflow_count)
96112
]
97113
start_seconds = time.monotonic() - pre_start_seconds
98114

@@ -101,7 +117,7 @@ async def report_mem():
101117
async with Worker(
102118
env.client,
103119
task_queue=task_queue,
104-
workflows=[BenchWorkflow],
120+
workflows=[BenchWorkflow, DeadlockInterruptibleWorkflow],
105121
activities=[bench_activity],
106122
workflow_runner=SandboxedWorkflowRunner()
107123
if args.sandbox

0 commit comments

Comments
 (0)