"""Task to update accounting_period's 'approve_sales_files' abacus_state.""" from lib.utils import ows from tasks.accounting_period_sales_approve import helpers def update_abacus_state_task(dag_run: dict, action_status: str, **kwargs) -> None: """Update accounting_period's 'approve_sales_files' abacus_state. Args: dag_run (dict): config of the DAG this task belongs to action_status (str): one of 'running', 'complete', or 'error' kwargs (dict): any other optional arguments """ event = helpers.get_event_from_params(dag_run, **kwargs) accounting_period_id = event.target_id approve_sales_files_action = helpers.get_abacus_state(accounting_period_id) abacus_state_id = approve_sales_files_action.get('abacus_state_id') ows.update_abacus_state(abacus_state_id, body={'action_status': action_status})