Sunday, December 11 2005

Scheduled Actions and the AGENDA server task

Take a look inside the AGENDA server task and learn the ins and outs of server-side scheduled processing

Tornado Server includes a server task that runs actions on a schedule, much like a *nix cron job or Windows AT command. This is great for sending automatic reminders or batch-updating a database.

To enable AGENDA, simply add it to the AddIns= line in the puakma.config or type 'load agenda' at the server console. eg: AddIns=puakma.addin.agenda.AGENDA or AddIns=AGENDA

Agenda allows scheduled actions to be run from once a second to once every X years.

How is a Scheduled Action different to a regular Action?

From a code perspective they are identical, just enter the code to be run in the execute() method of the action and AGENDA will take care fo teh rest. The major difference is that a regular action is executed by the HTTP task and runs in the context of a user (eg pSession will be the session object referring to the current user), whereas scheduled actions always run as a SYSTEM user (eg pSession does not refer to an actual user but a temporary system session created for the running of this action instance).

Scheduling information that determines when the action is run is stored on the design element for the scheduled action, in the options field. The AGENDA task will update the LastRun= value each time the action is run. This update does not change the last modified field of the design note. It is not recommended to update the Options field of the design element yourself.

Forcing a Scheduled Action to run

You can force a Scheduled Action to run immediately through the server console 'tell agenda run /app.pma/SchedActionName'. This command will execute the action immediately regardless of any schedule settings, however will not run if the action is currently executing in another thread. Only one instance of an action may run at any one time.

Resetting AGENDA

If a task gets locked up for some reason, the AGENDA task can be restarted by issuing the server command 'reload agenda'. This is the same as issuing an unload and a load.

AGENDA performance considerations

There are two issues to be aware of. First Scheduled Actions typically perform computationally intensive tasks (batch process thousands of records) so may place a heavy load on the server. Be aware of other actions running on that server instance ( 'tell agenda schedule' ) and schedule the actions to run at off-peak periods where possible.

puakma.config contains settings for controlling how many Scheduled Actions can be run at once and the poll interval for checking for updates to Scheduled Action design elements.

This allows 5 actions to be run at once. Additional actions will be queued and run when a slot becomes free.

Controls the number of minutes between each time the AGENDA task checks the design collection for changes.

Recent Comments

7qqg8Y zdazygsvgpgr, [url=]hdjqzflhknvk[/url], [link=]dlqfxqypetxm[/link],
Posted by yifwwa at   on   07.May.09 06:25
; home insurance zrd; life insurance uun; health insurance quotes ibien; mortgage rates rithv; car insurance yxh; tobacco 434;
Posted by scuko195 at   on   13.May.09 22:04
Make sure that you are not taking any medications that could thwart your efforts.; accutane ihcfi; generic viagra iimcgy; levitra 817190; viagra mtru;
Posted by scuko335 at   on   22.May.09 03:23
Since the 1930 8217 s the main and often only known treatment has been AA and the other 12-step programs.; prozac :-)); levitra :P; viagra 004; tamiflu 011696;
Posted by scuko221 at   on   22.May.09 06:27
It usually begins with a dry cracked skin which turns red as soon as itching starts.; tramadol 533; propecia zpm; prednisone 8); cialis kghrpi; valium %-)));
Posted by info at   on   09.Jun.09 02:18
Show all comments
Got something to say? Add comment