Spaces:
Runtime error
Runtime error
get_active_task_order
Browse files
app.py
CHANGED
|
@@ -244,8 +244,13 @@ def task_status(task_id):
|
|
| 244 |
return jsonify({'error': str(e)}), 500
|
| 245 |
|
| 246 |
def get_active_task_order(task_id):
|
|
|
|
| 247 |
non_processing_task_ids = [tid for tid, task in active_tasks.items() if not task.is_processing]
|
| 248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
|
| 250 |
# get_task_orderイベントハンドラー
|
| 251 |
@app.route('/get_task_order/<task_id>', methods=['GET'])
|
|
|
|
| 244 |
return jsonify({'error': str(e)}), 500
|
| 245 |
|
| 246 |
def get_active_task_order(task_id):
|
| 247 |
+
processing_task_ids = [tid for tid, task in active_tasks.items() if task.is_processing]
|
| 248 |
non_processing_task_ids = [tid for tid, task in active_tasks.items() if not task.is_processing]
|
| 249 |
+
if len(processing_task_ids) == 0:
|
| 250 |
+
task_order = 0
|
| 251 |
+
else:
|
| 252 |
+
task_order = non_processing_task_ids.index(task_id) + 1
|
| 253 |
+
return task_order
|
| 254 |
|
| 255 |
# get_task_orderイベントハンドラー
|
| 256 |
@app.route('/get_task_order/<task_id>', methods=['GET'])
|