"""Notify that generate_exports task has failed.""" from lib import constants from lib.utils import ows from tasks.payments_generate_export import helpers def notify_failure_task(dag_run: dict, **kwargs): """Update the 'generate_export' abacus_state status to 'error'. Args: dag_run (dict): a dag's config """ event = helpers.get_event_from_params(dag_run, **kwargs) action_name = constants.PAYMENT_GROUP_PAYMENT_ACTIONS.GENERATE_EXPORT abacus_state = helpers.get_abacus_state(action_name, event.target_id) ows.update_abacus_state( abacus_state.get('abacus_state_id'), body={ 'action_status': constants.ABACUS_STATE_STATUSES.ERROR } )