[Catalyst-dev] Catalyst-Engine-JobQueue-POE

Jonathan Rockway jon at jrock.us
Fri Sep 15 19:43:36 CEST 2006


> This engine is meant to be used by a separate process than the webserver
> (an example can be found in t/testapp_jobqueue.pl) to schedule actions
> to be executed at certain points in time (a al cron).
> 
> This is more a proof-of-concept implementation to see how things would
> work out with POE and mst's idea of the execution mechanism. T

This is what we were talking about in #catalyst a few days ago, right?

TODO:

- get crontab info from myapp_config, if it exists
- IPC, probably as catalyst plugin.
 - reason: so we can do $c->schedule('in 15 minutes', $foo);
 - auto-start the server when myapp_server/fastcgi/mod_perl runs

> 
> - there is no documentation (though the Engine is heavily inspired by
> the HTTP::POE engine)
> - the schedule is parsed from a crontab-like file (an example can be
> found in t/crontab
> - there is no support for authz (but planned for a future version)
> - the scheduling resolution is 1 minute
> - no support for at-like jobs (one-time execution) (but planned for a
> future version)
> - uncaught exceptions cause the process to die silently (ex: not finding
> a crontab file to parse)

Silently?  We should probably use $c->log.

> 
> Crontab syntax
> 
> Fields are whitespace separated
> The first 5 fields are a standard cronspec (man 5 crontab)
> The next field is a username (will be used for authz)
> The next field is a URI (used for dispatching)
> The rest of the fields are arguments (they are concatenated with '&' and
> passed as QUERY_STRING)

Why query string?  Why not just properly $c->execute with the various
arguments?  Nobody wants to urlencode their config file.  I will
probably make the config something like this:

Schedule:
  - 3:30 everday
    - execute: /foo/bar
        arguments:
          - baz
          - quux
    - execute: /foo/cleanup
        arguments:
          - hello
          - world

or something similar

> How does it work?
> 
> The jobqueue process shares everything but the Engine with the main
> catalyst application (Controllers, Models, Plugins, etc).

Perfect.

> As with C::E::HTTP::POE sending an USR1 signal to the jobqueue process
> will cause it to dump state.

Can you elaborate on this?

> 
> OK, that's about it
> Let the feedback begin :)

It has :)

Regards,
Jonathan Rockway



More information about the Catalyst-dev mailing list