Lior Barak
09/27/2023, 2:49 PMOscar
09/27/2023, 3:10 PMLior Barak
09/27/2023, 3:12 PMOscar
09/27/2023, 3:13 PMLior Barak
09/27/2023, 3:24 PMLior Barak
09/27/2023, 5:03 PMfrom prefect.client.schemas.objects import State, FlowRun
from prefect.client.schemas.objects import Flow as FlowSchema
def log_runtime(flow: FlowSchema, flow_run: FlowRun, state: State):
flow_run_time_seconds = (state.timestamp - flow_run.created).total_seconds()
print(f"flow_name: {flow.name}, runtime_seconds: {flow_run_time_seconds}")
Oscar
09/27/2023, 5:06 PM