Skip to content

Commit

Permalink
Update notification settings for imports
Browse files Browse the repository at this point in the history
  • Loading branch information
vish-cs committed Dec 10, 2024
1 parent a4d555a commit 36aaf12
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions import-automation/executor/app/executor/import_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def _import_one(
import_spec: Specification of the import as a dict.
"""
import_name = import_spec['import_name']
curator_emails = import_spec['curator_emails']
dc_email_aliases = [_ALERT_EMAIL_ADDR, _DEBUG_EMAIL_ADDR]
absolute_import_name = import_target.get_absolute_import_name(
relative_import_dir, import_name)
time_start = time.time()
Expand All @@ -294,14 +296,8 @@ def _import_one(
import_spec=import_spec,
)
time_taken = '{0:.2f}'.format(time.time() - time_start)
if self.notifier:
msg = f'Successful Import: {import_name} ({absolute_import_name})\nn'
msg += f'Script execution time taken = {time_taken}s'
self.notifier.send(
subject=f'Import Automation Success - {import_name}',
body=msg,
receiver_addresses=[_DEBUG_EMAIL_ADDR],
)
logging.info(f'Import Automation Success - {import_name}')
logging.info(f'Script execution time taken = {time_taken}s')

except Exception as exc:
if self.notifier:
Expand All @@ -312,7 +308,7 @@ def _import_one(
self.notifier.send(
subject=f'Import Automation Failure - {import_name}',
body=msg,
receiver_addresses=[_ALERT_EMAIL_ADDR, _DEBUG_EMAIL_ADDR],
receiver_addresses= dc_email_aliases + curator_emails,
)
raise exc

Expand Down Expand Up @@ -425,7 +421,7 @@ def _upload_import_inputs(
import_inputs: List of import inputs each as a dict mapping import types
to relative paths within the repository. This is parsed from the
'import_inputs' field in the manifest.
"
Returns:
ImportInputs object containing the paths to the uploaded inputs.
"""
Expand Down

0 comments on commit 36aaf12

Please sign in to comment.