There are 3 batches in my project. I have put all 3 batches in a single docker image. Now to run any particular batch I invoke the docker run with command line argument, which is taken into account by a shell script and launches appropriate batch inside the image.
Now to schedule these 3 batches at a different time period, I can use 3 commands for same docker images with proper arguments. But how to deploy (app engine or gke) and from where to fire the command? In cloud scheduler there is only Pub Sub / HTTP Url firing options are available. So not able to find any way out.
Can you suggest ?
Thanks in advance.
Regards,
Arindam
Your question raises questions but -- first -- why do you wish to employ App Engine or GKE?
IIUC you likely could solve your problem using Kubernetes CronJobs: https://cloud.google.com/kubernetes-engine/docs/how-to/cronjobs
Cloud Scheduler's use of HTTP and Pub/Sub is because this provides the service with a general-purpose way to fire its events. If you wished to pursue Cloud Scheduler, you could develop a companion (aka "sidecar") image that exposes an e.g. HTTP interface and, when invoked, it runs the correct command against your container. You then program Cloud Scheduler to invoke the sidecars on your schedule and they, in turn, invoke your container image. Something similar to this approach is employed in the Cloud Scheduler example here: https://cloud.google.com/scheduler/docs/start-and-stop-compute-engine-instances-on-a-schedule#set_up_the_functions_with
If you don't wish to use Kubernetes, I think the easiest solution would be for you to create a Compute Engine instance that runs your cron schedule and it simply invokes the appropriate docker run
commands on your image as needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With