def submit(self, command): job_id = 'job_' + self.prefix + uuid4().hex job = simcity.queue_job(Job({'_id': job_id}), self.method, host=self.host, database=self.database) try: job['batch_id'] = self._do_submit(job, command) except: simcity.archive_job(job, database=self.database) raise else: self.database.save(job) return job
def test_archive_job(self): job = simcity.get_job() self.db.save(job) job = simcity.archive_job(simcity.get_job()) assert_not_equals(job.id, self.test_id)