[Zope-dev] Cron jobs with lovely.remotetask - how to start?
Hermann Himmelbauer
dusty at qwer.tk
Wed Oct 15 16:15:35 EDT 2008
Hi,
In my application, I'd like to run a service once a day that does some
processing. It seems that lovely.remotetask can do that.
In my scenario, I have multiple sites, whereas each one should have such a
cron job. What I do is the following:
In zope.conf:
<product-config lovely.remotetask>
autostart *@*
</product-config>
And then, I created a subscriber for a INewSiteCreated event:
def cronLog():
logger.debug("Log Entry!")
cronLogTask = SimpleTask(cronLog)
provideUtility(cronLogTask, name=u'cronLog')
@adapter(INewSiteCreated)
def setupTasks(event):
service = TaskService()
sm = event.object.getSiteManager()
sm['default']['testTaskService1'] = service
sm.registerUtility(service, ITaskService, name='TestTaskService1')
jobid = service.addCronJob(u'cronLog',
minute = tuple(range(60)))
Ok, the problem is, that the service is not running, which can be shown
by "service.isProcessing()" -> False.
Thus I tried to add something like that at the end of the function:
service.startProcessing()
But that results in a traceback:
----------------
File "/home/dusty/prog/bsp/buildout/eggs/lovely.remotetask-0.2.13-py2.4.egg/lovely/remotetask/service.py",
line 158, in startProcessing
thread = threading.Thread(
AttributeError: 'NoneType' object has no attribute 'db'
----------------
This "db" attribute refers to an object attribute "self._p_jar.db()" - no clue
what that is or why it's None.
I also thought, that the directives in zope.conf would start my services on a
zope restart, but that's not the case.
Hmmm, any clues how to start my services?
Best Regards,
Hermann
--
hermann at qwer.tk
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7
More information about the Zope-Dev
mailing list