From 55953e32a776a0a4f44c496263139370c6edec45 Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Tue, 24 Oct 2023 16:10:04 -0500 Subject: [PATCH] Minor updates --- temporalio/client.py | 2 ++ tests/test_client.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/temporalio/client.py b/temporalio/client.py index d34ef866..aceb3301 100644 --- a/temporalio/client.py +++ b/temporalio/client.py @@ -406,6 +406,8 @@ async def start_workflow( memo: Memo for the workflow. search_attributes: Search attributes for the workflow. start_delay: Amount of time to wait before starting the workflow. + This does not work with ``cron_schedule``. This is currently + experimental. start_signal: If present, this signal is sent as signal-with-start instead of traditional workflow start. start_signal_args: Arguments for start_signal if start_signal diff --git a/tests/test_client.py b/tests/test_client.py index e24c7ab3..5760f7a6 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -163,6 +163,30 @@ async def test_start_delay( ) +async def test_signal_with_start_delay( + client: Client, worker: ExternalWorker, env: WorkflowEnvironment +): + if env.supports_time_skipping: + pytest.skip("Java test server does not support start delay") + start_delay = timedelta(hours=1, minutes=20, seconds=30) + handle = await client.start_workflow( + "kitchen_sink", + KSWorkflowParams( + actions=[KSAction(result=KSResultAction(value="some result"))] + ), + id=f"workflow-{uuid.uuid4()}", + task_queue=worker.task_queue, + start_delay=start_delay, + start_signal="some-signal", + ) + # Check that first event has start delay + first_event = [e async for e in handle.fetch_history_events()][0] + assert ( + start_delay + == first_event.workflow_execution_started_event_attributes.first_workflow_task_backoff.ToTimedelta() + ) + + async def test_result_follow_continue_as_new( client: Client, worker: ExternalWorker, env: WorkflowEnvironment ):