SIENTIAPDE-1445
Refactor workflow parameters in tests.ipynb and prepare_worker.py to enhance clarity and flexibility. Updated workflow_id and task_queue to accept dynamic values, and standardized timeout parameters for improved configuration.
This commit is contained in:
@@ -27,6 +27,8 @@ def prepare_worker(
|
||||
) -> Worker:
|
||||
main_workflow_name = main_workflow.__name__.upper()
|
||||
|
||||
queue_name = f'{main_workflow_name.lower().replace("_", "-")}-queue'
|
||||
|
||||
local_workflow_parameters = {}
|
||||
|
||||
for parameter in parameters:
|
||||
@@ -36,7 +38,7 @@ def prepare_worker(
|
||||
|
||||
return Worker(
|
||||
temporal_client,
|
||||
task_queue='scouter-queue',
|
||||
task_queue=queue_name,
|
||||
workflows=[main_workflow, *other_workflows],
|
||||
activities=[*activities],
|
||||
max_concurrent_workflow_tasks=local_workflow_parameters['MAX_CONCURRENT_WORKFLOW_TASKS'],
|
||||
|
||||
10
tests.ipynb
10
tests.ipynb
@@ -17,8 +17,8 @@
|
||||
" temporal_client: client.Client,\n",
|
||||
" workflow_name: str,\n",
|
||||
" workflow_input: dict[str, Any],\n",
|
||||
" workflow_id: str | None = None,\n",
|
||||
" task_queue: str = \"scouter-queue\",\n",
|
||||
" workflow_id: str,\n",
|
||||
" task_queue: str,\n",
|
||||
" execution_timeout: timedelta | None = None,\n",
|
||||
" run_timeout: timedelta | None = None,\n",
|
||||
" task_timeout: timedelta | None = None,\n",
|
||||
@@ -116,7 +116,11 @@
|
||||
" temporal_client=temporal_client,\n",
|
||||
" workflow_name='pi_web_api_scouter',\n",
|
||||
" workflow_input=input_data,\n",
|
||||
" workflow_id='test_workflow_id_' + now.strftime('%Y%m%d%H%M%S')\n",
|
||||
" workflow_id='test_workflow_id_' + now.strftime('%Y%m%d%H%M%S'),\n",
|
||||
" task_queue='pi-web-api-scouter-queue',\n",
|
||||
" execution_timeout=timedelta(seconds=30),\n",
|
||||
" run_timeout=timedelta(seconds=30),\n",
|
||||
" task_timeout=timedelta(seconds=30),\n",
|
||||
")\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user