Hi Everyone!! I have been experimenting with prefect lately and wanted to know if there is anything similar to s3 sensors in prefect.
I want to trigger my flow or make my tasks wait/run until there is a file/files being uploaded in the s3 buckets
k
Kevin Kho
10/11/2021, 3:54 PM
Hey @Vamsi Reddy, there isn’t one but you can do it the other way around where the s3 bucket triggers a lambda that creates a flow.
Otherwise you would need to just poll inside your task to determine if there was a change in the bucket
v
Vamsi Reddy
10/11/2021, 3:59 PM
Thanks for the info @Kevin Kho. Also are there any tutorials for this ?
k
Kevin Kho
10/11/2021, 4:01 PM
Not really but the StartFlowRun task has a polling mechanism. It’s just a loop
@Vamsi Reddy while lambda is the cleanest option, if you don't want to implement AWS Lambda with trigger, boto3 also has waiter abstraction that allows your code to wait until the file arrived - you could build something like this into your Prefect task (only the last 2 lines are interesting):
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.