OK thanks. I have 2 databases, a "main" db for the actual, prepared website content, and an "administrator" db, that holds the status for some unprepared, late-night data mining. I wanted to use the scheduler to run unsupervised tasks only on the administrator db. A final task would prepare some data and copy it into the main db.
Therefore the scheduler (and the admin db) doesn't really need to be loaded/exposed on every requests. I thought this separation would be good programmatically and for safety and security. So the conditional module loading sounded perfect for this. On Friday, November 1, 2013 9:43:53 AM UTC-7, Niphlod wrote: > > what's the usecase for this ? > > On Friday, November 1, 2013 3:34:28 PM UTC+1, Massimo Di Pierro wrote: >> >> Right now this is not supported. >> >> >> On Friday, 1 November 2013 03:06:41 UTC-5, [email protected] wrote: >>> >>> Hello, >>> >>> I'm using web2py 2.7.2. Is it possible to run a scheduler that's in a >>> conditional model file? For example I have this in >>> <app>/models/special/scheduler.py >>> >>> """ >>> >>> def task(): >>> >>> ... >>> >>> return 1 >>> >>> >>> from gluon.scheduler import Scheduler >>> >>> taskDB = DAL('sqlite://tasks.sqlite',pool_size=1,check_reserved=['all']) >>> >>> scheduler = Scheduler( taskDB, tasks={"My Task":task} ) >>> >>> """ >>> >>> >>> I can then successfully enqueue tasks using appadmin. >>> >>> However, I can't start the scheduler from the commandline using either >>> of these: >>> >>> ./web2py.py --nogui -K <app> >>> >>> ./web2py.py --nogui -K <app>/special >>> >>> >>> The first command fails with an expected traceback that it can't find >>> any scheduler: >>> >>> AttributeError: 'thread._local' object has no attribute '_scheduler' >>> >>> >>> But the second command treats the whole argument as an application name: >>> >>> Application '<app>/special' doesn't exist, skipping >>> >>> >>> Thanks in advance! >>> >>> Ian >>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

