File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
__all__ = [
2
2
"taskify" ,
3
3
"tasks" ,
4
- "dict " ,
4
+ "dictionary " ,
5
5
"states" ,
6
6
"current_task" ,
7
7
"update_task_progress" ,
13
13
14
14
from .pool import (
15
15
tasks ,
16
- dict ,
16
+ dictionary ,
17
17
states ,
18
18
current_task ,
19
19
update_task_progress ,
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ def tasks():
67
67
return DEFAULT_TASK_MASTER .tasks
68
68
69
69
70
- def dict ():
70
+ def dictionary ():
71
71
"""
72
72
Dictionary of tasks in default taskmaster
73
73
Returns:
Original file line number Diff line number Diff line change @@ -18,29 +18,29 @@ def get(self):
18
18
@Tag (["properties" , "tasks" ])
19
19
class TaskView (View ):
20
20
@marshal_with (TaskSchema ())
21
- def get (self , id ):
21
+ def get (self , task_id ):
22
22
"""
23
23
Show status of a session task
24
24
25
25
Includes progress and intermediate data.
26
26
"""
27
- try :
28
- task = tasks .dict ()[ id ]
29
- except KeyError :
27
+
28
+ task = tasks .dictionary (). get ( task_id )
29
+ if not task :
30
30
return abort (404 ) # 404 Not Found
31
31
32
32
return task
33
33
34
34
@marshal_with (TaskSchema ())
35
- def delete (self , id ):
35
+ def delete (self , task_id ):
36
36
"""
37
37
Terminate a running task.
38
38
39
39
If the task is finished, deletes its entry.
40
40
"""
41
- try :
42
- task = tasks .dict ()[ id ]
43
- except KeyError :
41
+
42
+ task = tasks .dictionary (). get ( task_id )
43
+ if not task :
44
44
return abort (404 ) # 404 Not Found
45
45
46
46
task .terminate ()
You can’t perform that action at this time.
0 commit comments