cloudtasker
cloudtasker copied to clipboard
Support cron scheduling via GCP Cloud Scheduler
Currently cron jobs are managed using Cloud Tasks and Redis. Investigate a way to also support Cloud Scheduler to eliminate the dependency on Redis.
Is it already worked one? If not, I can take a look at this one. I guess the starting point would be here https://github.com/keypup-io/cloudtasker/blob/master/lib/cloudtasker/cron/schedule.rb.
@Fodoj not it's not worked on yet. Feel free to give it a try! 😄
You can create a new module called CloudScheduler (instead of cron). The implementation should be relatively straightforward but there isn't much doc about the shape of the Cloud Scheduler webhooks. So you'll have to experiment via ngrok.
Cloud Scheduler does support unique names for jobs. It should therefore be possible to lookup / create if missing, same as the cron extension (see: https://github.com/keypup-io/cloudtasker/blob/master/lib/cloudtasker/cron/schedule.rb#L55)
Also, considering names must be truly unique in Cloud Scheduler, I recommend prefixing the schedule names with the gcp_queue_prefix (see https://github.com/keypup-io/cloudtasker/blob/master/lib/cloudtasker/config.rb#L188)
Let me know if you get stuck anywhere, I'm happy to help.
I'm not promising anything... but here I go :)
Hello all. First off, thank you for developing this gem - it's absolutely fantastic! I'm using this with ActiveJob in my current project.
Second, I'm wondering if there's any updates on this? I can definitely see a need for this in the future. I understand there is no way currently to implement cron + ActiveJob + cloudtasker? Similarly for job locks/uniqueness? Again, thank you for all the effort!
@matthewtory thanks a lot! I'm glad you like it 😊
There is still no way to support GCP cloud scheduler. This is next on my list after addressing #11
In the meantime you can make a small exception and use a native cloudtasker job for cron jobs (unless you use different backends for dev vs production)
Note that even if I add support for GCP Scheduler, I'm not sure how much it will be compatible with ActiveJob. ActiveJob has a minimal API due to the fact it must keep a consistent interface for many libraries.
Is this still going to be added? I see @ceritium worked on it but there hasn't been any updates on that PR in the last 6 months.
Is this still going to be added? I see @ceritium worked on it but there hasn't been any updates on that PR in the last 6 months.
Hi @MohamedBeydoun, please take a look at my last comment on the PR.
Is this still going to be added? I see @ceritium worked on it but there hasn't been any updates on that PR in the last 6 months.
Hi @MohamedBeydoun, please take a look at my last comment on the PR.
Thanks!