예제 #1
0
 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)
예제 #2
0
    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
예제 #3
0
    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]}