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

Recurring Jobs #92

Open
calumbrodie opened this issue Feb 21, 2014 · 6 comments
Open

Recurring Jobs #92

calumbrodie opened this issue Feb 21, 2014 · 6 comments

Comments

@calumbrodie
Copy link

Hi,

I've built on top of this bundle: https://github.com/usemarkup/JobQueueBundle
I was wondering if any of the features I've added would be better placed directly into this bundle.

Recurring Jobs

What I've added is a mechanism for adding console command jobs (executed within a job using the process component) via a recurring configuration file that is similar to the crontab (using cron syntax).

    - command: your:console:command --and --any --options and arguments
      schedule: 1-59/2 * * * *
      queue: name-of-a-valid-queue

Reasons for this:

  • Ability to maintain scheduling of jobs via version control, and throughout environments without having to edit a crontab across deployment environments. Using a single process for all async jobs (including recurring jobs) allows for a common logging/error handling strategy.
  • We tend to develop on the command line, writing console jobs for most activities first. While often these commands are just wrappers calling lower level services - it is useful to be able to schedule these jobs on a recurring basis.
  • If this functionality is useful it could/should be extended to execute services that implement the command pattern (i.e have an 'execute' method), rather than having to use the console component via the process component.

Queue Configuration

I've added stricter queue configuration, meaning that queues need to be defined in application configuration (ensuring jobs added in code have a defined way of being processed). Additionally this configuration can be read by a capistrano task which is able to automatically generate the supervisord configuration file based on the queues defined (currently automatically creates a single worker per queue, but this could be further configured via the config file).

Admin Interface

I've performed a minor refactoring here to support our own stack, I'd be happy to pull this out altogether and move into my own app/ folder

@michelsalib
Copy link
Owner

Thanks for your proposal. Can you make two PRs ?

  1. One for recurring job and associate UI
  2. One for queue configuration and associated UI
    I am not the core maintainer anymore, but I am sure @ruudk or @mrbase would be happy to merge those.

@calumbrodie
Copy link
Author

Hi,

I'd need to perform some refactoring of my work, and write some additional tests before making PR, but I'm happy to do that if these features will be useful.

@danhunsaker
Copy link

A few of these changes might even be so useful as to make it all the way up to PHP-Resque and PHP-Resque-Scheduler themselves. For example, cron-like functionality has always been intended in Scheduler, but the required logic simply hasn't been written/submitted yet. If your code for that doesn't rely on any framework functionality, that suddenly becomes a lot easier.

In other words, please, do. Worst case they'll say no. Best case they'll merge, and possibly even submit improvements upstream (though you could do that as well). Most likely there'll be a bit of back-and-forth on some of the minor details, but these seem like sound changes to include.

@bassrock
Copy link

👍

1 similar comment
@thomask
Copy link

thomask commented Aug 4, 2014

+1

@calumbrodie
Copy link
Author

Apologies but I'm not going to do this - I've moved on from this - but the code is still available if anyone wants to extract it:
https://github.com/usemarkup/JobQueueBundle/tree/0.1

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

No branches or pull requests

5 participants