Martim Lobao
12/22/2021, 10:23 AMAnna Geller
Martim Lobao
12/22/2021, 10:57 AMfrom prefect import Flow
from prefect.engine.results import PrefectResult
from prefect.executors import LocalDaskExecutor
from prefect.schedules import Schedule
from prefect.schedules.clocks import CronClock
from prefect.tasks.prefect import StartFlowRun
from prefect.utilities.notifications import slack_notifier
from pdl.common.config.env import get_stage
from pdl.core_compute.prefect.flows.shared import terminate_on_cancel
person_build_flow = StartFlowRun(flow_name="person-build", project_name=get_stage(), wait=True)
release_flow = StartFlowRun(flow_name="release", project_name=get_stage(), wait=True)
company_insights_flow = StartFlowRun(flow_name="company-insights", project_name=get_stage(), wait=True)
autocomplete_flow = StartFlowRun(flow_name="autocomplete", project_name=get_stage(), wait=True)
with Flow(
"build-then-release",
executor=LocalDaskExecutor(num_workers=8),
result=PrefectResult(),
schedule=Schedule(clocks=[CronClock("0 6 14-20 * 1", day_or=False)]),
state_handlers=[slack_notifier, terminate_on_cancel],
) as flow:
RELEASE_FLOW_IS_COMPLETE = release_flow(upstream_tasks=[person_build_flow], parameters={"is_development": "false"})
company_insights_flow(upstream_tasks=[RELEASE_FLOW_IS_COMPLETE])
autocomplete_flow(upstream_tasks=[RELEASE_FLOW_IS_COMPLETE])
in this particular case, i had started the flow and it failed during the first subflow. I finished the subflow separately and then marked it as successful, and when trying to restart the flow of flows i get this.
i will say that the difficulty in reproducibility is precisely what makes this frustrating: I had an identical issue yesterday where I was unable to restart a regular flow (the first subflow) for the same reason, and I eventually asked a co-worker if he was able to give it a try, and it worked for him on his first try. (i saw the flow immediately update from failed to scheduled after he restarted the flow, and no amount of refreshing would change the state when I was trying to restart it)Anna Geller
Martim Lobao
12/22/2021, 1:37 PMAnna Geller
Martim Lobao
12/22/2021, 2:29 PMAnna Geller