Skip to content

Commit

Permalink
Renamed tasks dict to fix PYL-W0622
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Collins committed Feb 11, 2020
1 parent 587e2a0 commit d7734de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions labthings/core/tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__all__ = [
"taskify",
"tasks",
"dict",
"dictionary",
"states",
"current_task",
"update_task_progress",
Expand All @@ -13,7 +13,7 @@

from .pool import (
tasks,
dict,
dictionary,
states,
current_task,
update_task_progress,
Expand Down
2 changes: 1 addition & 1 deletion labthings/core/tasks/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def tasks():
return DEFAULT_TASK_MASTER.tasks


def dict():
def dictionary():
"""
Dictionary of tasks in default taskmaster
Returns:
Expand Down
16 changes: 8 additions & 8 deletions labthings/server/views/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ def get(self):
@Tag(["properties", "tasks"])
class TaskView(View):
@marshal_with(TaskSchema())
def get(self, id):
def get(self, task_id):
"""
Show status of a session task
Includes progress and intermediate data.
"""
try:
task = tasks.dict()[id]
except KeyError:

task = tasks.dictionary().get(task_id)
if not task:
return abort(404) # 404 Not Found

return task

@marshal_with(TaskSchema())
def delete(self, id):
def delete(self, task_id):
"""
Terminate a running task.
If the task is finished, deletes its entry.
"""
try:
task = tasks.dict()[id]
except KeyError:

task = tasks.dictionary().get(task_id)
if not task:
return abort(404) # 404 Not Found

task.terminate()
Expand Down

0 comments on commit d7734de

Please sign in to comment.