From 46387d9dd63bdb36470f86663b9a4b33cc51f806 Mon Sep 17 00:00:00 2001 From: Massimo Di Pierro Date: Sun, 6 May 2012 17:32:27 -0500 Subject: [PATCH] better scheduler docs, thanks Michael --- VERSION | 2 +- gluon/scheduler.py | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 7b61aeef..cdcd3b2d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.7 (2012-05-06 17:29:21) dev +Version 1.99.7 (2012-05-06 17:32:01) dev diff --git a/gluon/scheduler.py b/gluon/scheduler.py index ed4d8879..e189c1d8 100644 --- a/gluon/scheduler.py +++ b/gluon/scheduler.py @@ -1,5 +1,3 @@ -#### WORK IN PROGRESS... NOT SUPPOSED TO WORK YET - USAGE = """ ## Example @@ -19,6 +17,8 @@ scheduler = Scheduler(db,dict(demo1=demo1,demo2=demo2)) ## run worker nodes with: cd web2py + python web2py.py -K myapp +or python gluon/scheduler.py -u sqlite://storage.sqlite \ -f applications/myapp/databases/ \ -t mytasks.py @@ -37,7 +37,23 @@ http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.scheduler_run.id>0 ## view workers http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.scheduler_worker.id>0 -## Comments +## To install the scheduler as a permanent daemon on Linux (w/ Upstart), put the +## following into /etc/init/web2py-scheduler.conf: +## (This assumes your web2py instance is installed in 's home directory, +## running as , with app , on network interface eth0.) + +description "web2py task scheduler" +start on (local-filesystems and net-device-up IFACE=eth0) +stop on shutdown +respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds. +exec sudo -u python /home//web2py/web2py.py -K +respawn + +## You can then start/stop/restart/check status of the daemon with: +sudo start web2py-scheduler +sudo stop web2py-scheduler +sudo restart web2py-scheduler +sudo status web2py-scheduler """ import os