Skip to content

Commit 7c61ed9

Browse files
committed
Unbreak task views by using the .name attribute on the task function
1 parent abc96d8 commit 7c61ed9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

hackyplayer/app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def api_tasks():
130130
if running_tasks:
131131
for name,host in running_tasks.items():
132132
for task in host:
133-
if task["type"] == "tasks.build_video":
133+
if task["type"] == tasks.build_video.name:
134134
state = app_cel.AsyncResult(task["id"])
135135
state.ready()
136136
result["data"].append({
@@ -148,7 +148,7 @@ def api_tasks():
148148
if scheduled_tasks:
149149
for name,host in scheduled_tasks.items():
150150
for task in host:
151-
if task["type"] == "tasks.build_video":
151+
if task["type"] == tasks.build_video.name:
152152
state = app_cel.AsyncResult(task["id"])
153153
state.ready()
154154
result["data"].append({
@@ -183,7 +183,7 @@ def api_watch():
183183
if running_tasks:
184184
for name,host in running_tasks.items():
185185
for task in host:
186-
if task["type"] == "tasks.watch_folder":
186+
if task["type"] == tasks.watch_folder.name:
187187
for folder in result["data"]:
188188
if folder["folder"] == task["args"][0]:
189189
folder["time_start"] = datetime.datetime.fromtimestamp(task["time_start"]).strftime('%Y-%m-%d %H:%M:%S'),
@@ -206,7 +206,7 @@ def api_watch_stop(folder=None):
206206

207207
for node,tasks in app_cel.control.inspect().active().items():
208208
for task in tasks:
209-
if (task["args"][0] == str(fullpath) or folder == None) and task["type"] == "tasks.watch_folder":
209+
if (task["args"][0] == str(fullpath) or folder == None) and task["type"] == tasks.watch_folder.name:
210210
app_cel.control.revoke(task["id"], terminate=True)
211211
return flask.jsonify({'success':True})
212212

@@ -236,7 +236,7 @@ def api_ingest():
236236
if running_tasks:
237237
for name,host in running_tasks.items():
238238
for task in host:
239-
if task["type"] == "tasks.ingest_video":
239+
if task["type"] == tasks.ingest_video.name:
240240
result["data"].append({
241241
"time_start": datetime.datetime.fromtimestamp(task["time_start"]).strftime('%Y-%m-%d %H:%M:%S'),
242242
"id": task["id"],
@@ -250,7 +250,7 @@ def api_ingest_stop(taskid=None):
250250

251251
for node,tasks in app_cel.control.inspect().active().items():
252252
for task in tasks:
253-
if task["id"] == taskid and task["type"] == "tasks.ingest_video":
253+
if task["id"] == taskid and task["type"] == tasks.ingest_video.name:
254254
app_cel.control.revoke(task["id"], terminate=True)
255255
return flask.jsonify({'success':True})
256256

0 commit comments

Comments
 (0)