Skip to content

Commit a8610fa

Browse files
committed
List waiting and not started encode tasks
1 parent f314972 commit a8610fa

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

app.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,8 @@ def view_tasks():
129129

130130
@app.route(app.config["api_route"]+"/tasks", methods=["GET"])
131131
def api_tasks():
132-
# result = {
133-
# "active": app_cel.control.inspect().active(),
134-
# "scheduled": app_cel.control.inspect().scheduled()
135-
# }
136132
running_tasks = app_cel.control.inspect().active()
133+
scheduled_tasks = app_cel.control.inspect().reserved()
137134
result = {"data": []}
138135
if running_tasks:
139136
for name,host in running_tasks.items():
@@ -149,6 +146,21 @@ def api_tasks():
149146
"out_tc": task["args"][3],
150147
"node": task["hostname"]
151148
})
149+
150+
if scheduled_tasks:
151+
for name,host in scheduled_tasks.items():
152+
for task in host:
153+
if task["type"] == "tasks.build_video":
154+
result["data"].append({
155+
"time_start": None,
156+
"id": task["id"],
157+
"source": task["args"][0],
158+
"title": task["args"][1]["title"],
159+
"presenter": task["args"][1]["presenter"],
160+
"in_tc": task["args"][2],
161+
"out_tc": task["args"][3],
162+
"node": task["hostname"]
163+
})
152164
return flask.jsonify(result)
153165

154166
@app.route(app.config["api_route"]+"/watch", methods=["GET"])
@@ -208,6 +220,7 @@ def api_watch_start(folder):
208220
},
209221
"success": True
210222
}
223+
break
211224
else:
212225
result = {
213226
"success": False

0 commit comments

Comments
 (0)