work in progress: cybertools.agent - more on base and sample implementations

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2416 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-02-24 15:11:05 +00:00
parent 9a5264f374
commit 9650935184
2 changed files with 10 additions and 1 deletions

View file

@ -154,6 +154,9 @@ is just one scheduler associated with the master agent.
>>> master.scheduler
<cybertools.agent.base.schedule.Scheduler object ...>
We schedule a sample job by taking the role of the controller and simply
call the master agent's callback method for entering jobs.
>>> from cybertools.agent.base.control import JobSpecification
>>> jobSpec = JobSpecification('sample', agent='sample01')
>>> master.setupJobs([jobSpec])

View file

@ -81,7 +81,13 @@ class Master(Agent):
class SampleAgent(Agent):
def execute(self, job, params=None):
print 'Job %s on agent %s has been executed.' % (job, self)
msg = 'Job %s on agent %s has been executed.' % (job, self)
print msg
self.log(msg)
def log(self, msg):
self.logger.log(dict(msg=msg))
agents.register(SampleAgent, Master, name='sample')