diff --git a/api/jobs/handlers.py b/api/jobs/handlers.py index 6ad71f063ba57cc7f3dcd662986579a1cab0da59..46802aa0a814a1647c0339e9645d22d6b52fd41a 100644 --- a/api/jobs/handlers.py +++ b/api/jobs/handlers.py @@ -310,7 +310,6 @@ class JobsHandler(base.RequestHandler): count = Queue.scan_for_orphans() return { 'orphaned': count } - class JobHandler(base.RequestHandler): """Provides /Jobs/<jid> routes.""" @@ -376,7 +375,6 @@ class JobHandler(base.RequestHandler): encoded = pseudo_consistent_json_encode({"config": c}) self.response.app_iter = StringIO.StringIO(encoded) - @require_login def put(self, _id): """ @@ -420,7 +418,6 @@ class JobHandler(base.RequestHandler): job.inputs[x].check_access(self.uid, 'ro') # Unlike jobs-add, explicitly not checking write access to destination. - def get_logs(self, _id): """Get a job's logs""" diff --git a/api/jobs/queue.py b/api/jobs/queue.py index 2a65b4dce5ca86d3fbff6b42772a8f17b8f8ec9a..4b9cc21b3c4719cb1a9c9c0d85bd271813530a35 100644 --- a/api/jobs/queue.py +++ b/api/jobs/queue.py @@ -32,6 +32,7 @@ JOB_STATES_ALLOWED_MUTATE = [ JOB_TRANSITIONS = [ 'pending --> running', 'pending --> cancelled', + 'running --> cancelled', 'running --> failed', 'running --> complete', ] @@ -57,8 +58,9 @@ class Queue(object): """ if job.state not in JOB_STATES_ALLOWED_MUTATE: - raise Exception('Cannot mutate a job that is ' + job.state + '.') + raise InputValidationException('Cannot mutate a job that is ' + job.state + '.') + # TODO: This should use InputValidationException or similar if 'state' in mutation and not valid_transition(job.state, mutation['state']): raise Exception('Mutating job from ' + job.state + ' to ' + mutation['state'] + ' not allowed.') diff --git a/api/placer.py b/api/placer.py index 49ee2b746a8e32d7d4e2ffaaed9819b94c9ba836..dc16c4482756d4392541ab2d6440e5e24a5c7f25 100644 --- a/api/placer.py +++ b/api/placer.py @@ -104,7 +104,6 @@ class Placer(object): session_id = AcquisitionStorage().get_container(str(self.id_)).get('session') SessionStorage().recalc_session_compliance(session_id, hard=True) - class TargetedPlacer(Placer): """ A placer that can accept N files to a specific container (acquisition, etc).