yeq6x commited on
Commit
46bd384
·
1 Parent(s): b38a367
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -42,7 +42,7 @@ active_tasks = {}
42
  task_futures = {}
43
 
44
  # ThreadPoolExecutorの作成
45
- executor = concurrent.futures.ThreadPoolExecutor(max_workers=2) # 8vCPUのインスタンスを使用
46
 
47
  gpu_lock = threading.Lock()
48
 
@@ -245,12 +245,11 @@ def task_status(task_id):
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
- return non_processing_task_ids.index(task_id) if task_id in non_processing_task_ids else 0
249
 
250
  # get_task_orderイベントハンドラー
251
  @app.route('/get_task_order/<task_id>', methods=['GET'])
252
  def handle_get_task_order(task_id):
253
- print(f'Active tasks order: {task_id}, Active tasks: {active_tasks.keys()}')
254
  if task_id in active_tasks.keys():
255
  return jsonify({'task_order': get_active_task_order(task_id)})
256
  else:
 
42
  task_futures = {}
43
 
44
  # ThreadPoolExecutorの作成
45
+ executor = concurrent.futures.ThreadPoolExecutor(max_workers=1) # 8vCPUのインスタンスを使用
46
 
47
  gpu_lock = threading.Lock()
48
 
 
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
+ return non_processing_task_ids.index(task_id)+1 if task_id in non_processing_task_ids else 0
249
 
250
  # get_task_orderイベントハンドラー
251
  @app.route('/get_task_order/<task_id>', methods=['GET'])
252
  def handle_get_task_order(task_id):
 
253
  if task_id in active_tasks.keys():
254
  return jsonify({'task_order': get_active_task_order(task_id)})
255
  else: