cybertools/agent/transport/transporter.txt
helmutm e0503fea5b add 'talk' package providing a common communication framework
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2923 fd906abe-77d9-0310-91a1-e0d9ade77398
2008-10-17 20:46:28 +00:00

52 lines
1.7 KiB
Text

================================================
Agents for Job Execution and Communication Tasks
================================================
($Id$)
>>> config = '''
... controller(names=['core.sample'])
... scheduler(name='core')
... logger(name='default', standard=30)
... transport.remote.server = 'testing'
... transport.remote.sftp = 'testing'
... transport.remote.url = 'http://localhost:8123'
... '''
>>> from cybertools.agent.main import setup
>>> master = setup(config)
Starting agent application...
Using controllers core.sample.
Transporter
===========
The agent uses Twisted's cooperative multitasking model.
The Transporter is used to contact an xmlrpc Server and transmit the metadata
to the other loops system. The Transporter is derived from Queueable agent
to ensure that only one item at a time is transmitted.
Returns a deferred that must be supplied with a callback method (and in
most cases also an errback method).
This Testcase is using subsidiary methods to simulate a real xmlrpc server.
>>> controller = master.controllers[0]
>>> controller.createAgent('transport.remote', 'sample03')
In the next step we request the start of a job, again via the controller.
>>> from cybertools.agent.crawl.base import Metadata, Resource
>>> md01 = Metadata(dict(filename='dummy.txt'))
>>> r01 = Resource()
>>> r01.metadata = md01
>>> r01.path = 'resource.txt'
>>> controller.enterJob('sample', 'sample03', params=dict(resource=r01))
The job is not executed immediately - we have to hand over control to
the twisted reactor first.
>>> from cybertools.agent.tests import tester
>>> tester.iterate()
Job 00001 completed; result: Metadata accepted by server;