"""Close the accounting period.""" from lib.constants import ACCOUNTING_PERIOD_STATUSES from lib.utils.ows import update_accounting_period from tasks.accounting_period_close.helpers import get_event_from_params def close_accounting_period_task(dag_run: dict, **kwargs): """Update accounting_period to be closed. Args: dag_run (dict): config of the DAG this task belongs to kwargs (dict): any other optional arguments` """ event = get_event_from_params(dag_run, **kwargs) accounting_period_id = event.target_id put_body = {'accounting_period_status': ACCOUNTING_PERIOD_STATUSES.CLOSED} update_accounting_period(accounting_period_id, put_body)