def can_deserialize_from_a_dictionary(self): job_ex = JobExecution.build_job_from_dict(self.job_dict) expect(job_ex.job_id).to.equal(self.job_dict['id']) expect(job_ex.tenant_id).to.equal(self.job_dict['tenant_id']) expect(job_ex.run_number).to.equal(self.job_dict['run_number']) expect(job_ex.status).to.equal('in-progress')
def on_head(self, req, resp, tenant_id, job_id): job = Job.get_job(job_id) job_ex = JobExecution.build_job_from_dict(job.as_dict()) if job: # TODO(jmv): Figure out scheduling of jobs JobExecution.save_job(job_ex) job.run_numbers.append(job_ex.run_number) Job.update_job(job) job = Job.get_job(job_id) execute_job.delay(job.id) resp.status = falcon.HTTP_200 else: msg = 'Cannot find job: {job_id}'.format(job_id=job_id) resp.status = falcon.HTTP_404 resp.body = json.dumps({'description': msg})
def before_all(self): self.job_dict = example_job_dict self.job_ex = JobExecution.build_job_from_dict(self.job_dict)