def on_get(self, req, resp, tenant_id, job_id, run_number): job_execution = JobExecution.get_job(run_number) JobExecution.save_job(job_execution) if job_execution: resp.body = self.format_response_body(job_execution.as_dict()) else: msg = 'Cannot find run number: {id}'.format(id=run_number) resp.status = falcon.HTTP_404 resp.body = json.dumps({'description': msg})
def on_get(self, req, resp, tenant_id, job_id, run_number): job_execution = JobExecution.get_job(run_number) JobExecution.save_job(job_execution) if job_execution: resp.body = self.format_response_body(job_execution.as_dict()) else: msg = 'Cannot find run number: {id}'.format(id=run_number) resp.status = falcon.HTTP_404 resp.body = json.dumps({'description': msg})
def execute_job(job_id, run_number): job = Job.get_job(job_id) if not job: return job_execution = JobExecution.get_job(run_number) for action in job.actions: plugin = get_action_plugin(ACTION_PLUGINS, action.action_type) if plugin: plugin.execute_action(job, action) else: job_execution.status = 'error' JobExecution.update_job(job_execution) print('Failed to execute action: {0}'.format(action.action_type)) if job_execution.status == 'in-progress': job_execution.status = 'complete' JobExecution.update_job(job_execution)
def execute_job(job_id, run_number): job = Job.get_job(job_id) if not job: return job_execution = JobExecution.get_job(run_number) for action in job.actions: plugin = get_action_plugin(ACTION_PLUGINS, action.action_type) if plugin: plugin.execute_action(job, action) else: job_execution.status = 'error' JobExecution.update_job(job_execution) print('Failed to execute action: {0}'.format(action.action_type)) if job_execution.status == 'in-progress': job_execution.status = 'complete' JobExecution.update_job(job_execution)
def can_get_a_job_execution(self): retrieved_job = JobExecution.get_job(self.job_ex.run_number, handler=self.handler) expect(len(self.handler.get_document.calls)).to.equal(1) expect(retrieved_job.run_number).to.equal(self.job_ex.run_number)
def can_get_a_job_execution(self): retrieved_job = JobExecution.get_job(self.job_ex.run_number, handler=self.handler) expect(len(self.handler.get_document.calls)).to.equal(1) expect(retrieved_job.run_number).to.equal(self.job_ex.run_number)