Please try again. I fixed the problem in trunk.

Step 1:

in your app try something like this

def demo(*a,**b): return 'hello(%s,%s)' % (a,b)
from gluon.scheduler import Scheduler
Scheduler(tasks=dict(demo=demo),heartbeat=10)

Step 2:

python2.6 web2yp.py  -K <appname>

Step 3:

http://..../<appname>/appadmin

to schedule a new task




On Sep 3, 3:26 pm, Brian M <bmere...@gmail.com> wrote:
> Massimo,
> I tried out the new scheduler in trunk with Windows 7 and Python 2.6.4 and
> I'm afraid I didn't get anywhere at all with it - perhaps I'm missing
> something about how to get it all going.  Here is what I did
>
>    1. Update to latest trunk
>    2. Launch web2py
>    3. Create new application named "scheduler"
>    4. Edited the new "scheduler" app and created models/scheduler.py with
>    the code shown at the top of the new gluon/scheduler.py
>    5. Went to database administration and Insert new scheduler_task - filled
>    in form telling it to run the demo1 function.
>    6. Upon trying to save I get an error ticket (see below)
>
>    Traceback (most recent call last):
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\restricted.py", line 194, in restricted
>        exec ccode in environment
>      File "C:/Users/Brian/Documents/development/web2py/google hg 
> repo/trunk/applications/scheduler/controllers/appadmin.py" 
> <http://localhost:8000/admin/default/edit/scheduler/controllers/appadm...>, 
> line 410, in <module>
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\globals.py", line 145, in <lambda>
>        self._caller = lambda f: f()
>      File "C:/Users/Brian/Documents/development/web2py/google hg 
> repo/trunk/applications/scheduler/controllers/appadmin.py" 
> <http://localhost:8000/admin/default/edit/scheduler/controllers/appadm...>, 
> line 127, in insert
>        if form.accepts(request.vars, session):
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\sqlhtml.py", line 1075, in accepts
>        hideerror=hideerror,
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\html.py", line 1797, in accepts
>        status = self._traverse(status,hideerror)
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\html.py", line 743, in _traverse
>        newstatus = c._traverse(status,hideerror) and newstatus
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\html.py", line 743, in _traverse
>        newstatus = c._traverse(status,hideerror) and newstatus
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\html.py", line 743, in _traverse
>        newstatus = c._traverse(status,hideerror) and newstatus
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\html.py", line 743, in _traverse
>        newstatus = c._traverse(status,hideerror) and newstatus
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\html.py", line 750, in _traverse
>        newstatus = self._validate()
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\html.py", line 1566, in _validate
>        (value, errors) = validator(value)
>      File "C:\Users\Brian\Documents\development\web2py\google hg 
> repo\trunk\gluon\scheduler.py", line 253, in __call__
>        return (value,current.T('invalid json'))
>    NameError: global name 'current' is not defined
>
>    7. Thinking that perhaps I need to run the new gluon/scheduler.py first I
>    did so as outlined in the file's comments. It just errors out saying it
>    can't import DAL
>
> C:\Users\Brian\Documents\development\web2py\google hg repo\trunk>python
> gluon\sc
> heduler.py -u sqlite://storage.sqlite -f applications/scheduler/databases/
> Traceback (most recent call last):
>   File "gluon\scheduler.py", line 64, in <module>
>     from gluon import DAL, Field, IS_NOT_EMPTY, IS_IN_SET
> ImportError: cannot import name DAL
> C:\Users\Brian\Documents\development\web2py\google hg repo\trunk>python
> gluon\sc
> heduler.py -u sqlite://storage.sqlite -f applications/scheduler/databases/
> Traceback (most recent call last):
>   File "gluon\scheduler.py", line 64, in <module>
>     from gluon import DAL, Field, IS_NOT_EMPTY, IS_IN_SET
> ImportError: cannot import name DAL
>
> So is there something that I'm doing wrong?
> ~Brian

Reply via email to