diff --git a/wubloader/job.py b/wubloader/job.py index 97ac4cb..04dac68 100644 --- a/wubloader/job.py +++ b/wubloader/job.py @@ -74,6 +74,8 @@ class Job(object): if not self.worker.ready(): self.worker.kill(block=False) self.row.update(state=states.FLOWS[self.job_type][0]) + if self.job_type != 'publish': + self.row.update(uploader="") def process(self): """Call this to perform the job.""" diff --git a/wubloader/wubloader.py b/wubloader/wubloader.py index d0f8501..db9ab0d 100644 --- a/wubloader/wubloader.py +++ b/wubloader/wubloader.py @@ -64,7 +64,7 @@ class Wubloader(object): while not self.stopping: for job in self.find_jobs(): - # If it's already claimed, ignore it. + # If it's already claimed (except by us), ignore it. # Note this check considers a claim by a dead bot to be invalid (except for publishes). if job.uploader and job.uploader != self.name: continue @@ -111,12 +111,13 @@ class Wubloader(object): self.stopped.set() def cleanup_existing(self): - """Scan for any existing rows claimed by us, and cancel them.""" - for sheet in self.sheets['main'] + self.sheets['chunks']: - for row in sheet: - if row.uploader == self.name and row.state != states.rollback(row.state): - logging.warning("Found existing in progress job for us, clearing") - row.update(state=states.rollback(row.state)) + """Scan for any existing non-publish rows claimed by us, and cancel them.""" + for job in self.find_jobs(): + if job.row.uploader == self.name and job.row.state != states.rollback(job.row.state): + logging.warning("Found existing in progress job for us, clearing") + job.row.update(state=states.rollback(job.row.state)) + if job.job_type != 'publish': + job.row.update(uploader="") def find_jobs(self): """Return potential jobs (based only on state), in priority order."""