never had this kind of requirement, so at the moment there's no such
possibility.
Just my 2 cents (and if this results unfeasible I'll think about more,
please bear with me for a moment)
For my current understanding, if you put that "megacall" into modules, when
the webserver is started (i.e. you are not a worker) the module is imported
only at the first access.
Assuming that in fact this is what happens, this "workaround" is not
feasible ?
Also, if you need "totally-separated" environments (i.e. you use some kind
of functions and/or modules ONLY in workers and NEVER in the web
application) why don't you use the "external" mode of the scheduler ?
i.e.
outside web2py folder , create tasks.py
import mysuperdupermodule
def mysuperfunction(args):
mysupderdupermodule.dothatwork(args)
tasks = dict(mytask=mysuperfunction)
and then start the scheduler NOT in embedded mode: cd to the web2py.py
folder and
python gluon/scheduler.py -u dburi -f applications/myapp/databases/ -t /path
/to/tasks.py
PS: in order to access the scheduler tables on the webapplication (i.e. you
queue there your tasks) you still need to have a models/scheduler.py with
from gluon.scheduler import Scheduler; mysched = Scheduler(db, migrate=False
)
That would remain a "dumb" call just to have the table definitions in place
and to be able to access them.
--