Spaces:
Sleeping
Sleeping
Terry Zhuo
commited on
Commit
·
7207b80
1
Parent(s):
44749d0
rm lock
Browse files
app.py
CHANGED
@@ -12,7 +12,6 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
|
12 |
|
13 |
default_command = "bigcodebench.evaluate"
|
14 |
is_running = False
|
15 |
-
lock = threading.Lock()
|
16 |
|
17 |
def generate_command(
|
18 |
jsonl_file, split, subset, parallel,
|
@@ -68,11 +67,10 @@ def find_result_file():
|
|
68 |
|
69 |
def run_bigcodebench(command):
|
70 |
global is_running
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
is_running = True
|
76 |
|
77 |
try:
|
78 |
yield f"Executing command: {command}\n"
|
@@ -85,7 +83,7 @@ def run_bigcodebench(command):
|
|
85 |
is_running = False
|
86 |
yield "Process terminated after 6 minutes timeout.\n"
|
87 |
|
88 |
-
|
89 |
timer = threading.Timer(360, kill_process)
|
90 |
timer.start()
|
91 |
|
@@ -107,8 +105,7 @@ def run_bigcodebench(command):
|
|
107 |
else:
|
108 |
yield "No result file found.\n"
|
109 |
finally:
|
110 |
-
|
111 |
-
is_running = False
|
112 |
|
113 |
def stream_logs(command, jsonl_file=None):
|
114 |
global is_running
|
@@ -172,7 +169,6 @@ with gr.Blocks() as demo:
|
|
172 |
yield log, gr.update(value=result_path, label=result_path), gr.update()
|
173 |
else:
|
174 |
yield log, gr.update(), gr.update()
|
175 |
-
is_running = False
|
176 |
result_file = find_result_file()
|
177 |
if result_file:
|
178 |
return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
|
|
|
12 |
|
13 |
default_command = "bigcodebench.evaluate"
|
14 |
is_running = False
|
|
|
15 |
|
16 |
def generate_command(
|
17 |
jsonl_file, split, subset, parallel,
|
|
|
67 |
|
68 |
def run_bigcodebench(command):
|
69 |
global is_running
|
70 |
+
if is_running:
|
71 |
+
yield "A command is already running. Please wait for it to finish.\n"
|
72 |
+
return
|
73 |
+
is_running = True
|
|
|
74 |
|
75 |
try:
|
76 |
yield f"Executing command: {command}\n"
|
|
|
83 |
is_running = False
|
84 |
yield "Process terminated after 6 minutes timeout.\n"
|
85 |
|
86 |
+
Start a timer to kill the process after 6 minutes
|
87 |
timer = threading.Timer(360, kill_process)
|
88 |
timer.start()
|
89 |
|
|
|
105 |
else:
|
106 |
yield "No result file found.\n"
|
107 |
finally:
|
108 |
+
is_running = False
|
|
|
109 |
|
110 |
def stream_logs(command, jsonl_file=None):
|
111 |
global is_running
|
|
|
169 |
yield log, gr.update(value=result_path, label=result_path), gr.update()
|
170 |
else:
|
171 |
yield log, gr.update(), gr.update()
|
|
|
172 |
result_file = find_result_file()
|
173 |
if result_file:
|
174 |
return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
|