SIENTIAPDE-1314

Refactor workflow calls to use subworkflow naming convention for load_notification_package and process_notifications in alerts and reports modules. Update corresponding tests to reflect these changes.
This commit is contained in:
vitor-aignosi
2025-10-27 10:24:16 -03:00
parent de08468dbe
commit 1e6616cfc2
6 changed files with 16 additions and 12 deletions

View File

@@ -67,7 +67,9 @@ class Alerts:
# Call subworkflow "load_notification_package" passing the static filters # Call subworkflow "load_notification_package" passing the static filters
# (level = "ERROR" and timestamp > last timestamp) # (level = "ERROR" and timestamp > last timestamp)
package = await workflow.execute_child_workflow('load_notification_package', input_data) package = await workflow.execute_child_workflow(
'subworkflow.load_notification_package', input_data
)
if not package['notification_package'] or not package['sending_configs']: if not package['notification_package'] or not package['sending_configs']:
return return
@@ -92,7 +94,7 @@ class Alerts:
# Call subworkflow "process_notifications" passing the notification package # Call subworkflow "process_notifications" passing the notification package
log_report = await workflow.execute_child_workflow( log_report = await workflow.execute_child_workflow(
'process_notifications', 'subworkflow.process_notifications',
{ {
'metadata': metadata, 'metadata': metadata,
'mail_type': mail_type, 'mail_type': mail_type,

View File

@@ -59,7 +59,9 @@ class Reports:
# Call subworkflow "load_notification_package" passing the static filters # Call subworkflow "load_notification_package" passing the static filters
# (timestamp > last timestamp) # (timestamp > last timestamp)
package = await workflow.execute_child_workflow('load_notification_package', input_data) package = await workflow.execute_child_workflow(
'subworkflow.load_notification_package', input_data
)
if not package['notification_package'] or not package['sending_configs']: if not package['notification_package'] or not package['sending_configs']:
return return
@@ -83,7 +85,7 @@ class Reports:
# Call subworkflow "process_notifications" passing the notification package # Call subworkflow "process_notifications" passing the notification package
await workflow.execute_child_workflow( await workflow.execute_child_workflow(
'process_notifications', 'subworkflow.process_notifications',
{ {
'metadata': metadata, 'metadata': metadata,
'mail_type': mail_type, 'mail_type': mail_type,

View File

@@ -9,7 +9,7 @@ with workflow.unsafe.imports_passed_through():
from orchestrator.activities.activities import Activities from orchestrator.activities.activities import Activities
@workflow.defn(name='load_notification_package') @workflow.defn(name='subworkflow.load_notification_package')
class LoadNotificationPackage: class LoadNotificationPackage:
""" """
Subworkflow for loading notification data and configuration. Subworkflow for loading notification data and configuration.

View File

@@ -10,7 +10,7 @@ with workflow.unsafe.imports_passed_through():
from orchestrator.activities.activities import Activities from orchestrator.activities.activities import Activities
@workflow.defn(name='process_notifications') @workflow.defn(name='subworkflow.process_notifications')
class ProcessNotifications: class ProcessNotifications:
""" """
Subworkflow for processing and sending notification emails. Subworkflow for processing and sending notification emails.

View File

@@ -31,7 +31,7 @@ async def test_run_full_flow(workflow_mock, alerts):
workflow_mock.execute_child_workflow.assert_has_calls( workflow_mock.execute_child_workflow.assert_has_calls(
[ [
call( call(
'load_notification_package', 'subworkflow.load_notification_package',
{**input_data, 'metadata': metadata, 'base_data_filter': {'level': 'ERROR'}}, {**input_data, 'metadata': metadata, 'base_data_filter': {'level': 'ERROR'}},
) )
] ]
@@ -40,7 +40,7 @@ async def test_run_full_flow(workflow_mock, alerts):
workflow_mock.execute_child_workflow.assert_has_calls( workflow_mock.execute_child_workflow.assert_has_calls(
[ [
call( call(
'process_notifications', 'subworkflow.process_notifications',
{ {
'metadata': metadata, 'metadata': metadata,
'mail_type': 'Alerts', 'mail_type': 'Alerts',
@@ -104,7 +104,7 @@ async def test_run_no_data(workflow_mock, alerts):
workflow_mock.execute_child_workflow.assert_has_calls( workflow_mock.execute_child_workflow.assert_has_calls(
[ [
call( call(
'load_notification_package', 'subworkflow.load_notification_package',
{**input_data, 'metadata': metadata, 'base_data_filter': {'level': 'ERROR'}}, {**input_data, 'metadata': metadata, 'base_data_filter': {'level': 'ERROR'}},
) )
] ]

View File

@@ -31,7 +31,7 @@ async def test_run_full_flow(workflow_mock, reports):
workflow_mock.execute_child_workflow.assert_has_calls( workflow_mock.execute_child_workflow.assert_has_calls(
[ [
call( call(
'load_notification_package', 'subworkflow.load_notification_package',
{**input_data, 'metadata': metadata, 'base_data_filter': {}}, {**input_data, 'metadata': metadata, 'base_data_filter': {}},
) )
] ]
@@ -40,7 +40,7 @@ async def test_run_full_flow(workflow_mock, reports):
workflow_mock.execute_child_workflow.assert_has_calls( workflow_mock.execute_child_workflow.assert_has_calls(
[ [
call( call(
'process_notifications', 'subworkflow.process_notifications',
{ {
'metadata': metadata, 'metadata': metadata,
'mail_type': 'Reports', 'mail_type': 'Reports',
@@ -88,7 +88,7 @@ async def test_run_no_data(workflow_mock, reports):
workflow_mock.execute_child_workflow.assert_has_calls( workflow_mock.execute_child_workflow.assert_has_calls(
[ [
call( call(
'load_notification_package', 'subworkflow.load_notification_package',
{**input_data, 'metadata': metadata, 'base_data_filter': {}}, {**input_data, 'metadata': metadata, 'base_data_filter': {}},
) )
] ]