Hi all, maybe a basic question, but here goes We h...
# prefect-getting-started
d
Hi all, maybe a basic question, but here goes We have a flow that is triggered to run every hour In random situations we have longer calculations that make the job run for more than an hour Is there a validation that can be added that a flow should not start before previous one finishes, something like
wait until finish
if it is running in same flow, we can check triggers, but can we do it on the flow level?
k
Are you using Prefect 2?
d
No, we still haven’t migrated, but we plan to do it in next couple of weeks If this is doable in version 2, this would be an even more reason to hurry up with the migration process
is it available in Prefect 2 or in 1 at all?
k
You can use
wait_for
with tasks in 2.0. Here is the doc for that
Off the top of my head, you can make sure one flow run after another one finishes in 2.0 by using subflows:
Copy code
from prefect import flow

@flow 
def run_first():
  ...

@flow 
def run_second():
  ...

@flow
def main():
  run_first()
  run_second()
d
Perfect, thank you, we will try it out
but not sure if this would work, since this is the same flow and has multiple runs, so it will run hourly and we can’t really define run_first() or run_second() hence this is the same flow just running hourly so the idea would be that if in the same flow we have multiple runs and one of them runs longer, we simply tell the next run to wait