keep state information with jobs; provide feedback to master and controller via 'inform()' methods
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2493 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
7cf1a59bae
commit
4d8f1e7cf1
5 changed files with 12 additions and 8 deletions
|
@ -156,10 +156,13 @@ is just one scheduler associated with the master agent.
|
|||
<cybertools.agent.base.schedule.Scheduler object ...>
|
||||
|
||||
We schedule a sample job by calling an internal method of the agent's
|
||||
controller.
|
||||
controller. In addition to the output of the job execution itself we
|
||||
also get a note from the controller about the feedback it received
|
||||
about the outcome of the job execution.
|
||||
|
||||
>>> master.controllers[0].enterJob('sample', 'sample01')
|
||||
Job 00001 on agent sample01 has been executed.
|
||||
Job 00001 completed; result: None;
|
||||
|
||||
Logging
|
||||
-------
|
||||
|
@ -174,6 +177,7 @@ Logging
|
|||
>>> master.controllers[0].enterJob('sample', 'sample01')
|
||||
Job 00002 on agent sample01 has been executed.
|
||||
2... agent:sample01 job:00002 message:job execution result:OK
|
||||
Job 00002 completed; result: None;
|
||||
|
||||
>>> for r in master.logger.records:
|
||||
... print r
|
||||
|
@ -214,4 +218,4 @@ the ``iterate()`` method provided for testing.
|
|||
>>> from cybertools.agent.tests import tester
|
||||
>>> tester.iterate()
|
||||
Job 00001 on agent sample01 has been executed.
|
||||
|
||||
Job 00001 completed; result: Done;
|
||||
|
|
|
@ -56,6 +56,11 @@ class SampleController(Controller):
|
|||
|
||||
agents = (('sample01', 'base.sample'),)
|
||||
|
||||
def inform(self, identifier, state, result=None, message=''):
|
||||
msg = ('Job %s %s; result: %s; %s' %
|
||||
(identifier, state, result, message))
|
||||
print msg
|
||||
|
||||
def _getAgents(self):
|
||||
return [AgentSpecification(name, type) for name, type in self.agents]
|
||||
|
||||
|
|
|
@ -43,4 +43,4 @@ the twisted reactor first.
|
|||
>>> from cybertools.agent.tests import tester
|
||||
>>> tester.iterate()
|
||||
SampleCrawler is collecting.
|
||||
|
||||
Job 00001 completed; result: [];
|
||||
|
|
|
@ -56,7 +56,3 @@ class MailCrawler(Crawler):
|
|||
def login(self):
|
||||
pass
|
||||
|
||||
#would it make sense to register this one at the AdapterFactory?
|
||||
#or should it also just serve as base class for OutlookCrawler
|
||||
#KMailCrawler etc. ?
|
||||
#agents.register(MailCrawler, Agent, name='crawl.mail')
|
|
@ -97,7 +97,6 @@ class IMaster(IAgent):
|
|||
|
||||
def inform(job, result=None, message=''):
|
||||
""" Callback for informing the master about the state of a job.
|
||||
The result is an IResource object (if not None).
|
||||
"""
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue