File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/labthings/default_views Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 3
3
4
4
from ..views import View
5
5
from ..views .marshalling import marshal_with
6
+ from ..views .args import use_args
6
7
from ..schema import TaskSchema
7
8
from ..find import current_labthing
9
+ from .. import fields
8
10
9
11
10
12
class TaskList (View ):
@@ -46,21 +48,22 @@ def get(self, task_id):
46
48
47
49
return TaskSchema ().dump (task )
48
50
49
- def delete (self , task_id ):
51
+ @use_args ({"timeout" : fields .Int ()})
52
+ def delete (self , args , task_id ):
50
53
"""Terminate a running task.
51
54
52
55
If the task is finished, deletes its entry.
53
56
54
57
:param task_id:
55
58
56
59
"""
57
-
60
+ timeout = args . get ( "timeout" , None )
58
61
task_dict = current_labthing ().actions .to_dict ()
59
62
60
63
if task_id not in task_dict :
61
64
return abort (404 ) # 404 Not Found
62
65
63
66
task = task_dict .get (task_id )
64
- task .stop (timeout = 5 )
67
+ task .stop (timeout = timeout )
65
68
66
69
return TaskSchema ().dump (task )
You can’t perform that action at this time.
0 commit comments