From c918861972ecdaa22772266f40e5a8828f8df731 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 20 Oct 2010 18:29:25 -0700 Subject: [PATCH] Fix dropped receive during ThreadManager._spawn_jobs. --- pysawsim/manager/__init__.py | 7 +++++-- pysawsim/manager/thread.py | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) 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) -- 2.26.2