Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cron scheduling via GCP Cloud Scheduler #20

Open
alachaum opened this issue Jan 14, 2021 · 8 comments
Open

Support cron scheduling via GCP Cloud Scheduler #20

alachaum opened this issue Jan 14, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@alachaum
Copy link
Member

Currently cron jobs are managed using Cloud Tasks and Redis. Investigate a way to also support Cloud Scheduler to eliminate the dependency on Redis.

@Fodoj
Copy link

Fodoj commented Jan 16, 2021

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.

@alachaum
Copy link
Member Author

@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.

@vovimayhem
Copy link
Contributor

I'm not promising anything... but here I go :)

@matthewtory
Copy link

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!

@alachaum
Copy link
Member Author

@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.

@MohamedBeydoun
Copy link

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.

@ceritium
Copy link

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.

@MohamedBeydoun
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants