rails / solid_queue

Database-backed Active Job backend
MIT License
1.95k stars 130 forks source link

Recurring Tasks - still confused #420

Open Nilpointer opened 1 day ago

Nilpointer commented 1 day ago

Hi,

I am still unsure how to manage reccuring tasks.

Can I simply edit the solid_queue_recurring_tasks schedule value or does this cause unwanted sideeffects?

Regards Andreas

rosa commented 1 day ago

How do I delete them? ( I don't understand the provided solutions - sorry)

You delete them from your recurring.yml configuration (or another file if you are configuring them elsewhere).

How can I pause them? Can I?

No, pausing them is not supported. You'd need to remove them and then re-add them.

How can I update the schedule value at runtime with no downtime?

You'd need to have a no-downtime deploy as you need to update your configuration and deploy your code.

Can I simply edit the solid_queue_recurring_tasks schedule value or does this cause unwanted sideeffects?

This won't work in general because in most cases the scheduler will have the tasks already loaded from when it started, and then when it restarts, it'll read the configuration and would load any task there again, overwriting your changes in solid_queue_recurring_tasks.

Nilpointer commented 1 day ago

Hi rosa!

How do I delete them? ( I don't understand the provided solutions - sorry)

You delete them from your recurring.yml configuration (or another file if you are configuring them elsewhere).

But how? If I remove the development node from my schedule.yml, restart the application - the entries in the solid_queue_recurring_tasks table are still there. Removing the two tasks under development having an empty development node also has no effect on the database.

development:
  periodic_import:
    class: CollectCsvJob
    schedule: every 99 months
  periodic_export:
    class: ExportJob
    schedule: at 12:03pm every day
staging:
  periodic_import:
    class: CollectCsvJob
    schedule: every 99 months
  periodic_export:
    class: ExportJob
    schedule: at 7pm every day
production:
  periodic_import:
    class: CollectCsvJob
    schedule: every 99 months
  periodic_export:
    class: ExportJob
    schedule: at 7pm every day

You'd need to have a no-downtime deploy as you need to update your configuration and deploy your code.

My application is running in kubernetes - the plan was to manage my schedule.yml as a config map to avoid new releases everytime i want to change the schedule. But then I need a way to trigger kind of an update (or restart the pod)

Thanks for your great support and work!

Regards Andreas

rosa commented 1 day ago

But how? If I remove the development node from my schedule.yml, restart the application - the entries in the solid_queue_recurring_tasks table are still there.

Yes, sorry, they're there but it doesn't mean they're running. See https://github.com/rails/solid_queue/issues/382. I'll change that so they get deleted as well when the scheduler reloads again. I just haven't had time this week.

Nilpointer commented 1 day ago

Is there a way to inspect/query what jobs are currently scheduled?