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:
@@ -67,7 +67,9 @@ class Alerts:
|
||||
# Call subworkflow "load_notification_package" passing the static filters
|
||||
# (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']:
|
||||
return
|
||||
@@ -92,7 +94,7 @@ class Alerts:
|
||||
|
||||
# Call subworkflow "process_notifications" passing the notification package
|
||||
log_report = await workflow.execute_child_workflow(
|
||||
'process_notifications',
|
||||
'subworkflow.process_notifications',
|
||||
{
|
||||
'metadata': metadata,
|
||||
'mail_type': mail_type,
|
||||
|
||||
@@ -59,7 +59,9 @@ class Reports:
|
||||
# Call subworkflow "load_notification_package" passing the static filters
|
||||
# (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']:
|
||||
return
|
||||
@@ -83,7 +85,7 @@ class Reports:
|
||||
|
||||
# Call subworkflow "process_notifications" passing the notification package
|
||||
await workflow.execute_child_workflow(
|
||||
'process_notifications',
|
||||
'subworkflow.process_notifications',
|
||||
{
|
||||
'metadata': metadata,
|
||||
'mail_type': mail_type,
|
||||
|
||||
@@ -9,7 +9,7 @@ with workflow.unsafe.imports_passed_through():
|
||||
from orchestrator.activities.activities import Activities
|
||||
|
||||
|
||||
@workflow.defn(name='load_notification_package')
|
||||
@workflow.defn(name='subworkflow.load_notification_package')
|
||||
class LoadNotificationPackage:
|
||||
"""
|
||||
Subworkflow for loading notification data and configuration.
|
||||
|
||||
@@ -10,7 +10,7 @@ with workflow.unsafe.imports_passed_through():
|
||||
from orchestrator.activities.activities import Activities
|
||||
|
||||
|
||||
@workflow.defn(name='process_notifications')
|
||||
@workflow.defn(name='subworkflow.process_notifications')
|
||||
class ProcessNotifications:
|
||||
"""
|
||||
Subworkflow for processing and sending notification emails.
|
||||
|
||||
@@ -31,7 +31,7 @@ async def test_run_full_flow(workflow_mock, alerts):
|
||||
workflow_mock.execute_child_workflow.assert_has_calls(
|
||||
[
|
||||
call(
|
||||
'load_notification_package',
|
||||
'subworkflow.load_notification_package',
|
||||
{**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(
|
||||
[
|
||||
call(
|
||||
'process_notifications',
|
||||
'subworkflow.process_notifications',
|
||||
{
|
||||
'metadata': metadata,
|
||||
'mail_type': 'Alerts',
|
||||
@@ -104,7 +104,7 @@ async def test_run_no_data(workflow_mock, alerts):
|
||||
workflow_mock.execute_child_workflow.assert_has_calls(
|
||||
[
|
||||
call(
|
||||
'load_notification_package',
|
||||
'subworkflow.load_notification_package',
|
||||
{**input_data, 'metadata': metadata, 'base_data_filter': {'level': 'ERROR'}},
|
||||
)
|
||||
]
|
||||
|
||||
@@ -31,7 +31,7 @@ async def test_run_full_flow(workflow_mock, reports):
|
||||
workflow_mock.execute_child_workflow.assert_has_calls(
|
||||
[
|
||||
call(
|
||||
'load_notification_package',
|
||||
'subworkflow.load_notification_package',
|
||||
{**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(
|
||||
[
|
||||
call(
|
||||
'process_notifications',
|
||||
'subworkflow.process_notifications',
|
||||
{
|
||||
'metadata': metadata,
|
||||
'mail_type': 'Reports',
|
||||
@@ -88,7 +88,7 @@ async def test_run_no_data(workflow_mock, reports):
|
||||
workflow_mock.execute_child_workflow.assert_has_calls(
|
||||
[
|
||||
call(
|
||||
'load_notification_package',
|
||||
'subworkflow.load_notification_package',
|
||||
{**input_data, 'metadata': metadata, 'base_data_filter': {}},
|
||||
)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user