Morgan Slade
07/11/2024, 10:23 PMMarvin
07/11/2024, 10:24 PMprefect.deployments.run_deployment
:
Utilize the run_deployment
function to trigger another deployment from within a flow.
Here’s an example code snippet demonstrating this:
python
from prefect import flow
from prefect.deployments import run_deployment
@flow
def master_flow():
# Trigger the first deployment
state = run_deployment(name="sr-daily-update-process-poll-compute-upload")
# Wait for the first deployment to finish
if state.is_completed():
# Trigger the second deployment
run_deployment(name="oner-gz")
else:
print("The first deployment did not complete successfully.")
if __name__ == "__main__":
master_flow()
3. Create and Deploy the Master Flow:
Create a deployment for this master flow and schedule it to run at the desired time (1:30 AM in your case).
This approach ensures that oner-gz
runs only after sr-daily-update-process-poll-compute-upload
completes successfully.
If you specifically need a no-code solution and still prefer using Prefect's automations, unfortunately, this functionality isn't supported directly at this moment.
For further details and updates, consider monitoring relevant GitHub issues or Prefect documentation.
I hope this helps with your orchestration needs. If you have any further questions, feel free to ask!Morgan Slade
07/11/2024, 10:25 PM