SIENTIAPDE-1150
fix: implement schedule normalization and timestamp management in MongoDB activities, enhance orchestration workflow with new formatting and normalization methods
This commit is contained in:
109
test.ipynb
109
test.ipynb
@@ -110,7 +110,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 3,
|
||||
"id": "7d01f160",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -128,9 +128,6 @@
|
||||
" namespace=os.getenv('TEMPORAL_NAMESPACE', 'default')\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"manager = TemporalManager(temporal_client=temporal_client,\n",
|
||||
" logger=logger,\n",
|
||||
" notification_handler=MagicMock())\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
@@ -382,7 +379,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 4,
|
||||
"id": "f81b3728",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -390,12 +387,112 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'_client': <temporalio.client.Client object at 0x770086544f90>, 'id': 'orchestrator'}\n"
|
||||
"{'id': 'orchestrator', 'schedule': ScheduleListSchedule(action=ScheduleListActionStartWorkflow(workflow='orchestrator'), spec=ScheduleSpec(calendars=[], intervals=[ScheduleIntervalSpec(every=datetime.timedelta(seconds=3600), offset=None)], cron_expressions=[], skip=[], start_at=None, end_at=None, jitter=None, time_zone_name=None), state=ScheduleListState(note=None, paused=False)), 'info': ScheduleListInfo(recent_actions=[ScheduleActionResult(scheduled_at=datetime.datetime(2025, 7, 14, 9, 0, tzinfo=datetime.timezone.utc), started_at=datetime.datetime(2025, 7, 14, 9, 0, 0, 165083, tzinfo=datetime.timezone.utc), action=ScheduleActionExecutionStartWorkflow(workflow_id='orchestrator-2025-07-14T09:00:00Z', first_execution_run_id='01980829-9700-771a-9c9d-2450eecc9af4')), ScheduleActionResult(scheduled_at=datetime.datetime(2025, 7, 14, 10, 0, tzinfo=datetime.timezone.utc), started_at=datetime.datetime(2025, 7, 14, 10, 0, 0, 125309, tzinfo=datetime.timezone.utc), action=ScheduleActionExecutionStartWorkflow(workflow_id='orchestrator-2025-07-14T10:00:00Z', first_execution_run_id='01980860-8578-759d-97fa-dbdfc784f88a')), ScheduleActionResult(scheduled_at=datetime.datetime(2025, 7, 14, 11, 0, tzinfo=datetime.timezone.utc), started_at=datetime.datetime(2025, 7, 14, 11, 0, 0, 124356, tzinfo=datetime.timezone.utc), action=ScheduleActionExecutionStartWorkflow(workflow_id='orchestrator-2025-07-14T11:00:00Z', first_execution_run_id='01980897-73f7-7e83-a7a6-20eaac38e7d4')), ScheduleActionResult(scheduled_at=datetime.datetime(2025, 7, 14, 12, 0, tzinfo=datetime.timezone.utc), started_at=datetime.datetime(2025, 7, 14, 12, 0, 0, 167329, tzinfo=datetime.timezone.utc), action=ScheduleActionExecutionStartWorkflow(workflow_id='orchestrator-2025-07-14T12:00:00Z', first_execution_run_id='019808ce-62a2-75d6-b11d-c5387cfa258f')), ScheduleActionResult(scheduled_at=datetime.datetime(2025, 7, 14, 13, 0, tzinfo=datetime.timezone.utc), started_at=datetime.datetime(2025, 7, 14, 13, 0, 0, 167575, tzinfo=datetime.timezone.utc), action=ScheduleActionExecutionStartWorkflow(workflow_id='orchestrator-2025-07-14T13:00:00Z', first_execution_run_id='01980905-5122-7807-90ae-3782d0332e79'))], next_action_times=[datetime.datetime(2025, 7, 14, 14, 0, tzinfo=datetime.timezone.utc), datetime.datetime(2025, 7, 14, 15, 0, tzinfo=datetime.timezone.utc), datetime.datetime(2025, 7, 14, 16, 0, tzinfo=datetime.timezone.utc), datetime.datetime(2025, 7, 14, 17, 0, tzinfo=datetime.timezone.utc), datetime.datetime(2025, 7, 14, 18, 0, tzinfo=datetime.timezone.utc)]), 'typed_search_attributes': TypedSearchAttributes(search_attributes=[]), 'search_attributes': {}, 'data_converter': DataConverter(payload_converter_class=<class 'temporalio.converter.DefaultPayloadConverter'>, payload_codec=None, failure_converter_class=<class 'temporalio.converter.DefaultFailureConverter'>, payload_converter=<temporalio.converter.DefaultPayloadConverter object at 0x787d51390750>, failure_converter=<temporalio.converter.DefaultFailureConverter object at 0x787d5277b590>), 'raw_entry': schedule_id: \"orchestrator\"\n",
|
||||
"info {\n",
|
||||
" spec {\n",
|
||||
" interval {\n",
|
||||
" interval {\n",
|
||||
" seconds: 3600\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" workflow_type {\n",
|
||||
" name: \"orchestrator\"\n",
|
||||
" }\n",
|
||||
" recent_actions {\n",
|
||||
" schedule_time {\n",
|
||||
" seconds: 1752483600\n",
|
||||
" }\n",
|
||||
" actual_time {\n",
|
||||
" seconds: 1752483600\n",
|
||||
" nanos: 165083498\n",
|
||||
" }\n",
|
||||
" start_workflow_result {\n",
|
||||
" workflow_id: \"orchestrator-2025-07-14T09:00:00Z\"\n",
|
||||
" run_id: \"01980829-9700-771a-9c9d-2450eecc9af4\"\n",
|
||||
" }\n",
|
||||
" start_workflow_status: WORKFLOW_EXECUTION_STATUS_COMPLETED\n",
|
||||
" }\n",
|
||||
" recent_actions {\n",
|
||||
" schedule_time {\n",
|
||||
" seconds: 1752487200\n",
|
||||
" }\n",
|
||||
" actual_time {\n",
|
||||
" seconds: 1752487200\n",
|
||||
" nanos: 125309119\n",
|
||||
" }\n",
|
||||
" start_workflow_result {\n",
|
||||
" workflow_id: \"orchestrator-2025-07-14T10:00:00Z\"\n",
|
||||
" run_id: \"01980860-8578-759d-97fa-dbdfc784f88a\"\n",
|
||||
" }\n",
|
||||
" start_workflow_status: WORKFLOW_EXECUTION_STATUS_COMPLETED\n",
|
||||
" }\n",
|
||||
" recent_actions {\n",
|
||||
" schedule_time {\n",
|
||||
" seconds: 1752490800\n",
|
||||
" }\n",
|
||||
" actual_time {\n",
|
||||
" seconds: 1752490800\n",
|
||||
" nanos: 124356906\n",
|
||||
" }\n",
|
||||
" start_workflow_result {\n",
|
||||
" workflow_id: \"orchestrator-2025-07-14T11:00:00Z\"\n",
|
||||
" run_id: \"01980897-73f7-7e83-a7a6-20eaac38e7d4\"\n",
|
||||
" }\n",
|
||||
" start_workflow_status: WORKFLOW_EXECUTION_STATUS_COMPLETED\n",
|
||||
" }\n",
|
||||
" recent_actions {\n",
|
||||
" schedule_time {\n",
|
||||
" seconds: 1752494400\n",
|
||||
" }\n",
|
||||
" actual_time {\n",
|
||||
" seconds: 1752494400\n",
|
||||
" nanos: 167329351\n",
|
||||
" }\n",
|
||||
" start_workflow_result {\n",
|
||||
" workflow_id: \"orchestrator-2025-07-14T12:00:00Z\"\n",
|
||||
" run_id: \"019808ce-62a2-75d6-b11d-c5387cfa258f\"\n",
|
||||
" }\n",
|
||||
" start_workflow_status: WORKFLOW_EXECUTION_STATUS_COMPLETED\n",
|
||||
" }\n",
|
||||
" recent_actions {\n",
|
||||
" schedule_time {\n",
|
||||
" seconds: 1752498000\n",
|
||||
" }\n",
|
||||
" actual_time {\n",
|
||||
" seconds: 1752498000\n",
|
||||
" nanos: 167575982\n",
|
||||
" }\n",
|
||||
" start_workflow_result {\n",
|
||||
" workflow_id: \"orchestrator-2025-07-14T13:00:00Z\"\n",
|
||||
" run_id: \"01980905-5122-7807-90ae-3782d0332e79\"\n",
|
||||
" }\n",
|
||||
" start_workflow_status: WORKFLOW_EXECUTION_STATUS_RUNNING\n",
|
||||
" }\n",
|
||||
" future_action_times {\n",
|
||||
" seconds: 1752501600\n",
|
||||
" }\n",
|
||||
" future_action_times {\n",
|
||||
" seconds: 1752505200\n",
|
||||
" }\n",
|
||||
" future_action_times {\n",
|
||||
" seconds: 1752508800\n",
|
||||
" }\n",
|
||||
" future_action_times {\n",
|
||||
" seconds: 1752512400\n",
|
||||
" }\n",
|
||||
" future_action_times {\n",
|
||||
" seconds: 1752516000\n",
|
||||
" }\n",
|
||||
"}\n",
|
||||
"}\n",
|
||||
"{'_client': <temporalio.client.Client object at 0x787d53dd3490>, 'id': 'orchestrator'}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"async for schedule in await temporal_client.list_schedules():\n",
|
||||
" print(vars(schedule))\n",
|
||||
" id = schedule.id\n",
|
||||
"\n",
|
||||
" handle = temporal_client.get_schedule_handle(id)\n",
|
||||
|
||||
Reference in New Issue
Block a user