OK, I've managed get the scheduler to partially work under windows. I had
to add if __name__ == '__main__': to web2py.py right before actually
starting web2py (line 19). This appears to have solved the problem of web2py
starting over and over again, now when I run python web2py.py -K
schedulerweb2py only starts up once. :) (likely due
to http://docs.python.org/library/multiprocessing.html#windows)
But, now that the scheduler is running under windows, it appears that none
of the debug output gets send to the windows console :( However, it does
look like the scheduler is actually doing its thing and checking for tasks
and actually running them :) I've been able to schedule the demo1 function
and get it to run ... as long as I only assign it args, for whatever reason
if I give it some vars too then it fails. But hey, this is a lot farther
that I've managed to get with the scheduler under Windows that previously!
*My scheduled task*
def demo1(*args,**vars):
print 'you passed args=%s and vars=%s' % (args, vars)
return 'done!'
*When trying to run with vars = {"foo":"bar"}, which worked fine under Linux
*
Traceback (most recent call last):
File "C:\Users\Brian\Documents\development\web2py\google hg
repo\trunk\gluon\scheduler.py", line 133, in executor
result = dumps(_function(*loads(task.args),**loads(task.vars)))
TypeError: demo1() keywords must be strings
Other findings, if you edit a scheduler_task, it appears to lead to the
scheduler crashing:
Traceback (most recent call last):
File "C:\Users\Brian\Documents\development\web2py\google hg
repo\trunk\gluon\s
hell.py", line 214, in run
exec(python_code, _env)
File "<string>", line 1, in <module>
File "C:\Users\Brian\Documents\development\web2py\google hg
repo\trunk\gluon\s
cheduler.py", line 334, in loop
MetaScheduler.loop(self)
File "C:\Users\Brian\Documents\development\web2py\google hg
repo\trunk\gluon\s
cheduler.py", line 228, in loop
task = self.pop_task()
File "C:\Users\Brian\Documents\development\web2py\google hg
repo\trunk\gluon\s
cheduler.py", line 353, in pop_task
logging.debug(' grabbed %s tasks' % number_grabbed)
UnboundLocalError: local variable 'number_grabbed' referenced before
assignment
Massimo, hopefully all this will help you get the new Scheduler sorted out.
~Brian