I have been able to put together a pipeline that trigger a step function in AWS through a python script which estimated to run for 7 hours and the next job in the pipeline depends on the successful completion of the step function. The next job is also a python script that generate tables in snowflakes for 30 hours. This is working as expected, but there is need for improvement. The build agent in the Azure devops pipeline is waiting for 30 hours which is not good. I am looking at efficient way to trigger the python script that call the snowflakes and exit the pipeline to stop the build agent from waiting.
What are the options available?
- Is it possible to use lambda to call this snowflakes and exit the pipeline and how would the pipeline get notification if anything goes wrong ?
Lambda Functions timeout after 15 minutes. So, just putting your script into Lambda Function won't work.
- There is suggestion to use webbook and have not used webhook before, is there any pointer to use this?
Webhook is just a way of invoking another service via HTTP call. When you call Lambda Function or Step Function via API Gateway, you can consider it as a webhook. There might be also a webhook on Snowflake side to perform some actions. This doesn't solve the script execution part though.
I suggest to use Step Function with Lambda Functions in the following way:
You can see your individual execution results in CloudWatch – useful for debugging and statistics.
This will work if each SQL query runs under 15 minutes. If not, you can consider running the script in container environment, EC2 Spot instance, or AWS Batch.