Dominik Wagner

09/09/2022, 1:10 PM
Prefect 2.3.1 - CI/CD: I run a freshly deployed flow at the end of my CI/CD pipeline, and would like to know whether or not the run was successful. My current idea is to poll the API for the state of the submitted run until it reaches a terminal state. Has anyone implemented a solution like this, or do you have another idea on how to solve this? 🙏

Sahil Rangwala

09/09/2022, 2:56 PM
@Dominik Wagner Hey! You are on the right track, in 2.0 you are looking for the `Completed`state, so you could use this in your conditional.

Dominik Wagner

09/09/2022, 4:21 PM
Yep, was more a question about whether polling an API like this is a good idea in a CI/CD workflow

Rajvir Jhawar

09/09/2022, 5:30 PM
Typically you wouldn't use a CI/CD pipeline to do long polling like this. You should probably re-think your design. It is easier setup a system that is designed for long polling (web server) and then have that callback your CI/CD pipeline to finish processing. A really hacky solution would be to have your CI/CD pipeline wait for some kind of notification. For instance in prefect you can send notifications when the task is complete via email or slack. I am pretty sure you can modify a slack bot so that it has the ability to forward the received request to your CI/CD pipeline.

Dominik Wagner

09/09/2022, 6:31 PM
Thanks for the input, Rajvir, much appreciated! I think that's what I intuitively felt (hence the question), but I still can't quite articulate why - I'll take this to our DevOps team 😉