From: W. Trevor King Date: Thu, 21 Oct 2010 01:29:25 +0000 (-0700) Subject: Fix dropped receive during ThreadManager._spawn_jobs. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c918861972ecdaa22772266f40e5a8828f8df731;p=sawsim.git Fix dropped receive during ThreadManager._spawn_jobs. --- diff --git a/pysawsim/manager/__init__.py b/pysawsim/manager/__init__.py index 0e01ac6..71d591c 100644 --- a/pysawsim/manager/__init__.py +++ b/pysawsim/manager/__init__.py @@ -205,13 +205,16 @@ class JobManager (object): jobs[id] = self._jobs.pop(id) while len(ids) > 0: # wait for outstanding jobs job = self._receive_job() - log().debug('receive job %s (%s)' % (job, job.status)) - job.copy_onto(self._jobs[job.id]) + self._handle_received_job(job) if job.id in ids and job.id in self._jobs: jobs[job.id] = self._jobs.pop(job.id) ids.remove(job.id) return jobs + def _handle_received_job(self, job): + log().debug('receive job %s (%s)' % (job, job.status)) + job.copy_onto(self._jobs[job.id]) + def _receive_job(self): raise NotImplementedError diff --git a/pysawsim/manager/thread.py b/pysawsim/manager/thread.py index 636545b..5eb0edc 100644 --- a/pysawsim/manager/thread.py +++ b/pysawsim/manager/thread.py @@ -124,7 +124,9 @@ class ThreadManager (JobManager): return False def _spawn_job(self, job): - self._receive_job(block=False) + j = self._receive_job(block=False) + if j != None: + self._handle_received_job(j) if self._job_is_blocked(job): log().debug('block job %s' % job) self._blocked.append(job)