Module pipelines.rj_escritorio.cleanup.tasks
Task definitions for the cleanup pipeline.
Functions
def cancel_flow_run(flow_run_dict: Dict[str, str], client: prefect.client.client.Client = None) ‑> None
-
Cancels a flow run from the API.
def delete_flow_run(flow_run_dict: Dict[str, str], client: prefect.client.client.Client = None) ‑> None
-
Deletes a flow run from the API.
def get_old_flow_runs(days_old: int, client: prefect.client.client.Client = None, skip_running: bool = True) ‑> List[Dict[str, str]]
-
Fetches old flow runs from the API.
Args
days_old
:int
- The age of the flow runs (in days) to fetch.
client
:Client
, optional- The prefect client. Defaults to None.
skip_running
:bool
, optional- Whether to skip running flow runs. Defaults to True.
Returns
A list containing one dictionary for every flow we got. The format for the dictionary is the following:
{ "id": "some-uuid4", "state": "the-final-state-for-this-flow", "start_time": "2022-01-01T00:00:00.000000+00:00 }
def get_old_running_flow_runs(older_than_days: int, client: prefect.client.client.Client = None)
-
Fetches old running flow runs from the API.
Args
older_than_days
:int
- The age of the flow runs (in days) to fetch.
client
:Client
, optional- The prefect client. Defaults to None.
Returns
A list containing one dictionary for every flow we got. The format for the dictionary is the following:
{ "id": "some-uuid4", "state": "the-final-state-for-this-flow", "start_time": "2022-01-01T00:00:00.000000+00:00 }
def get_prefect_client() ‑> prefect.client.client.Client
-
Returns the prefect client.