https://prefect.io logo
Title
b

Benoit Chabord

04/19/2022, 8:43 PM
I am wondering if there is a pattern that exists in prefect 2.0 to say that a Flow had nothing to do. My use case is that I have a Flow checking every 5min for files in the s3 bucket of a partner and when they are files I process them with a series of tasks. The dashboard is showing a lot of successful tasks. Would using a subflow be a good pattern there? One flow "checking" and one flow "processing" ? Maybe having a sub flow status "success nothing to do" would work. I also have another use case, in the same flow I am processing those files and 0.1% of the records are not "valid" I am logging them as warnings but wondering if there is a way to report on those "invalid" records, seems to be a pretty common use case
đź‘Ť 1
k

Kevin Kho

04/19/2022, 9:04 PM
I think a long running flow that dynamically submits tasks for the processing with a while loop is easier than using subflows for 2.0 and then you can mark those tasks as failed. You can also make it a daily flow that polls just so you can check on a per day basis in the UI
b

Benoit Chabord

04/19/2022, 9:09 PM
Thanks Kevin, yes I think a long running flow would make sense there. But I am using a serverless version with cloud functions at the moment and cloud scheduler for activation (This is a good reason to not be serverless though). I will give it a try with Subflows and see if it works for my use case
k

Kevin Kho

04/19/2022, 9:14 PM
Oh then you can just run the flow directly and have your activation run the flow instead right? and the flow can contain one task?
b

Benoit Chabord

04/19/2022, 9:16 PM
The flow contains 5 tasks but I only start the tasks if they are files on the bucket, if not I finish the flow with success with no tasks. It is just very hard in the UI to find a flow that processed something, that's why I was looking at subflow
k

Kevin Kho

04/19/2022, 9:18 PM
I am a bit confused. Shouldn’t we just do something like trigger the flow from a lambda then when something comes in the bucket?
b

Benoit Chabord

04/19/2022, 9:30 PM
I can't that's not my bucket
k

Kevin Kho

04/19/2022, 9:31 PM
Ahhh I understand. Sounds good!
b

Benoit Chabord

04/19/2022, 9:31 PM
But yeah if it was my bucket I would trigger a pub sub message to start the flow that would be awesome 🙂
j

Jeremiah

04/20/2022, 11:48 AM
@Benoit Chabord thanks for sharing this use case - it’s awesome to discover what people are doing with 2.0. One pattern we would suggest is to use the dashboard filters to filter out the “checking” flow’s noise and create a view that only includes your “processing” flow. However, I’m also noting your desire to see confirmation that the “processing” flow was kicked off and affirmatively decided not to do work (similar to Prefect 1.0's skipped state). We have a couple thoughts there, let me explore a bit. High level, Prefect 2.0 supports custom user states (e.g. you could create a “Skipped” state yourself) but the UI doesn’t show them in a special way, so it’s not especially useful at the moment. We’ll start working on the right way to advance that story.
Lastly, I expect your valid / invalid report will be straightforward as part of a big feature we’re working on. I don’t have a release estimate for you yet but it’s on the roadmap!