cloudtasker
cloudtasker copied to clipboard
Configure a specific processor_host for Cloudtasker::Cron::Schedule
Use case:
Have one Cloud Run service for user actions and ActiveJob Tasks, and another Cloud Run Service with more CPU and Memory resources to run heavier schedule tasks.
application_service => 01 vcpu 512M application_cron_tasks => 04 vcpu 8gb RAM
For ActiveJob tasks, use config.processor_host = "application_service.run.app"
For Cloudtasker::Cron::Schedule ( Workers ), use processor_host = "application_cron_tasks.run.app"
Would it be possible?
@wagnerpereira At the moment it is not possible. However what is possible is to have one Cloud Run service for "regular" web traffic (user actions, API requests) and one Cloud Run service for background jobs.
It could be made possible to specify the processor host on each worker. That is the most elegant approach I believe.
class HeavyCronWorker
include Cloudtasker::Worker
cloudtasker_options processor_host: 'heavy-worker.run.app'
def perform(some_arg)
#... some heavy work
end
end
Feel free to submit a PR. From a config perspective it should be similar to max_retries
(configurable at global level or worker level).
@alachaum Thanks for all the work done in cloudtasker to help Rails apps runs smooth in Cloud Run. ❤️
I will try this approach. I'm moving large background schedule workloads from sidekiq to Cloud Tasks using cloudtasker.
02 months in production without any issues until now, nut now I have huge schedule tasks that need a higher configuration on cloud run service instance.
Thanks again!
No worries! Don't hesitate to let me know if you struggle with this PR - I'm happy to help 👍