Laramie2 commited on
Commit
86e89a3
·
verified ·
1 Parent(s): c2ef9b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -5,8 +5,7 @@ import shutil
5
  import subprocess
6
  import sys
7
  from datetime import datetime
8
- import concurrent.futures
9
-
10
 
11
  # 初始化环境路径
12
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -153,12 +152,12 @@ def run_final_generation(task_type="all"):
153
 
154
  try:
155
  # 使用 ThreadPoolExecutor 并行执行脚本
156
- with concurrent.futures.ThreadPoolExecutor(max_workers=len(scripts_to_run)) as executor:
157
  # 提交所有任务
158
  future_to_script = {executor.submit(execute_script, s): s for s in scripts_to_run}
159
 
160
  # as_completed 会在某个任务完成时立刻生成结果
161
- for future in concurrent.futures.as_completed(future_to_script):
162
  script_name = future_to_script[future]
163
  try:
164
  # 获取该任务的执行结果
 
5
  import subprocess
6
  import sys
7
  from datetime import datetime
8
+ from concurrent.futures import ThreadPoolExecutor, as_completed
 
9
 
10
  # 初始化环境路径
11
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
 
152
 
153
  try:
154
  # 使用 ThreadPoolExecutor 并行执行脚本
155
+ with ThreadPoolExecutor(max_workers=len(scripts_to_run)) as executor:
156
  # 提交所有任务
157
  future_to_script = {executor.submit(execute_script, s): s for s in scripts_to_run}
158
 
159
  # as_completed 会在某个任务完成时立刻生成结果
160
+ for future in as_completed(future_to_script):
161
  script_name = future_to_script[future]
162
  try:
163
  # 获取该任务的执行结果