"""Task to update the sales_file's 'approve_sales' abacus_state.""" from lib.utils import ows from tasks.sales_approve import helpers def update_abacus_state_task(dag_run: dict, action_status: str, **kwargs): """Update 'approve_sales' abacus_state to reflect status of approving sales. 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) sales_file_id = event.target_id approve_sales_action = helpers.get_abacus_state(sales_file_id) abacus_state_id = approve_sales_action.get('abacus_state_id') ows.update_abacus_state(abacus_state_id, body={'action_status': action_status})