I have a python application, that performs some tasks. I run it inside a docker container.
I need to schedule this script to run every 30 minutes. Currently, I take this 30 min
as a command-line argument while running the script. I wrap my execution logic inside a forever running while loop that sleeps for 30 minutes. Is this pattern of running a microservice architecture pattern? Should I convert it into a flask API and schedule the API to run every 30 minutes?
Asked
Active
Viewed 480 times
0

Ramneet Singh
- 115
- 2
- 8
-
For this task you can use crontab. For example - https://stackoverflow.com/questions/37458287/how-to-run-a-cron-job-inside-a-docker-container – V. Mokrecov Mar 01 '22 at 11:44
1 Answers
0
You can use k8s cronjob which will work same like normal cronjob but it will run your container on scheduled time . ref# https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/

Dhiraj Surve
- 310
- 2
- 5