Dan Milstein wrote:
What's the best way to get a block of code to run when the Webware
server starts?
Specifically, I'd like to create a bunch of Tasks and register them
with the TaskKit Scheduler. But I'm not seeing where to configure that.
Thanks,
-Dan
The __init__ of your context is one place. The App calls
contextInitialize() for each context, if the function is defined, and
passes itself, which you can use to get a reference to the Task Manager.
In your context's __init__.py file you can put:
def contextInitialize(app, contextPath):
''' Called by the WebKit Application whenever the context loads '''
# Tasks
# Add our application-wide tasks, if the appserver is persistent
if app._server.isPersistent():
taskMgr = app.taskManager()
taskMgr.addPeriodicAction( ... )
taskMgr.addTimedAction( ... )
hope that helps - Ben
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss