Skip to content
Snippets Groups Projects
Unverified Commit 076e0795 authored by Nathaniel Kofalt's avatar Nathaniel Kofalt Committed by GitHub
Browse files

Merge pull request #1032 from scitran/user-cancel

Allow users to cancel running jobs
parents 1c312f70 ec16cbaa
No related branches found
No related tags found
No related merge requests found
......@@ -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"""
......
......@@ -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.')
......
......@@ -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).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment