"""Task to update the sales_file's 'get_eligible_sales' abacus_state.""" from lib.utils import ows from tasks.sales_get_eligible import helpers def update_abacus_state_task(dag_run: dict, action_status: str, **kwargs) -> None: """Update 'get_eligible_sales' abacus_state to reflect status of getting 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 get_eligible_sales_action = helpers.get_abacus_state(sales_file_id) abacus_state_id = get_eligible_sales_action.get('abacus_state_id') params = {'action_status': action_status} ows.update_abacus_state(abacus_state_id, body=params)