exq icon indicating copy to clipboard operation
exq copied to clipboard

Task scheduler (Recurring Jobs)

Open thousandsofthem opened this issue 10 years ago • 10 comments

Is there a good way to do (or plans to add such functionality) so? Recurring Jobs is really useful concept for some maintenance jobs like periodic cleanup

maybe even cron-style, e.g. https://github.com/resque/resque-scheduler#scheduled-jobs-recurring-jobs

P.S. probably https://github.com/c-rack/quantum-elixir is the solution

thousandsofthem avatar Aug 07 '15 14:08 thousandsofthem

There is nothing built in to exq, but you can definitely use a cron style scheduler and then use the Enqueuer to queue jobs. :+1: to using quantum-elixir, I think that is probably the best approach.

I can also see there being an external package to make this integration easier (adding ability to declare jobs and parameters and maybe some UI display similar to resque-scheduler ), but unless there's a good reason, there's probably not a need to include this functionality in the exq project. Anyways, let me know what you end up doing and whether there ends up being a good reason to integrate this into exq and we can discuss.

akira avatar Aug 09 '15 00:08 akira

One more thing possibly to consider as well is dealing with multiple nodes, making sure that the cron scheduling only runs on one node out of the group.

akira avatar Aug 11 '15 00:08 akira

wow quantum-elixir is great!

umurgdk avatar Sep 03 '15 18:09 umurgdk

@umurgdk did you use it with Exq for scheduling jobs, how did it work out?

akira avatar Sep 08 '15 01:09 akira

@akira umm im just trying to learn elixir and experimenting https://github.com/umurgdk/elixir_resources. But for me it works perfectly :) Quantum just triggers the module like:

config :quantum, cron: [
  "* * * * *": {"ElixirResources.Workers.CronJobs", :look_videos},
  "* * * * *": {"ElixirResources.Workers.CronJobs", :look_rss},
]

For example :look_rss does;

def look_rss do
    IO.puts "Loading all resources from RssResource"

    Enum.each Repo.all(RssResource), fn(rss_resource) ->
        IO.puts "Loading rss resource: #{rss_resource.url}"
        Exq.enqueue :exq, "aggregator", "ElixirResources.Workers.RSSWorker", [rss_resource.url]
    end
end

We didn't tested yet with hundreds of resources. But we thought it might me useful to enqueue a job for each rss url and let the exq handle these jobs.

umurgdk avatar Sep 08 '15 10:09 umurgdk

@umurgdk looks good, will check the project out! Let me know if you run into any issues.

akira avatar Sep 09 '15 06:09 akira

@akira cool thanks :)

umurgdk avatar Sep 09 '15 08:09 umurgdk

Closing for now as quantum-elixir can handle this. Will reopen if anyone brings up any needed changes for exq.

akira avatar Sep 10 '15 03:09 akira

I'm going to reopen this issue - will be open to any implementations for exq. I was actually thinking it would be nice to tie this in the exq UI as well.

akira avatar Oct 16 '15 02:10 akira

BTW, we had a similar requirement and created https://github.com/activesphere/exq-scheduler

ananthakumaran avatar Jun 09 '18 12:06 ananthakumaran

Closing this, we have exq-scheduler and the support for UI has been merged to exq_ui master

ananthakumaran avatar Aug 21 '22 04:08 ananthakumaran