Hi guys,<br>I am still having trouble writing programs that will make the most use of deferreds.&nbsp; I will describe the problem I am trying to solve and the solution I've tried.<br><br>The problem:<br>I am trying to write a client that gets a job from a PB server, processes it, submits the result and gets another job.&nbsp; I need to be able to do this for multiple jobs (
i.e. I need to be able to get 5 jobs, and start 5 similar chains: get job --&gt; work on job --&gt; submit result --&gt; get another job).&nbsp; This looks like a perfectly solvable problem using deferreds since working on the job might take a while and using callbacks seems to be the most appropriate.&nbsp; 
<br><br>So I have something like this in my main method:<br><br>monitor = Monitor(server, port)<br>monitor.connect()&nbsp; <br clear="all"><br><br>&nbsp;&nbsp;&nbsp; def connect(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; factory = pb.PBClientFactory()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reactor.connectTCP
(self.hostname, self.port, factory)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return factory.login(self.credentials).addCallback(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._connected).addErrback(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._catch_failure)<br><br>Then in self._connected I would like to start the chain of getting jobs/processing them/submitting jobs:
<br><br>&nbsp;&nbsp;&nbsp; def _connected(self, remoteobj):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.remoteobj = remoteobj<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for worker in self.workers:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.get_jobs(worker).addCallback(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._got_job, worker).addCallback(
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.get_jobs, worker).addErrback(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._catch_failure)<br><br>_got_job takes both a job and a worker and starts to process the job.&nbsp; Which for now returns a 
defer.succeed().<br>This is the part where I stumble on though, the exact implementation of how to make it so that one calls back the other.&nbsp; <br>Any help would be appreciated.&nbsp; Please let me know also if you need more specific information.
<br><br>Thanks,<br>Yi