def delete(self, job_id): """ Cancel a Job """ job_info = get_job_info(job_id) if not job_info: abort(404, message="Job {} doesn't exist".format(job_id)) remove_job(job_id)
def get(self, job_id): """Retrieve job state information """ job_info = get_job_info(job_id) if not job_info: abort(404, message="Job {} doesn't exist".format(job_id)) return job_info
def put(self, job_id, action): """Change the state of a job """ job_info = get_job_info(job_id) if not job_info: abort(404, message="Job {} doesn't exist".format(job_id)) if action == "remove": remove_job(job_id) elif action == "hold": hold_job(job_id) elif action == "continue": continue_job(job_id) else: abort(400, message="Action {} is not known".format(action)) return {'result': [job_id, action]}