Spaces:
Runtime error
Runtime error
Commit
·
c0e96e4
1
Parent(s):
1bbdc1e
Avoid stop current running ML worker until exit
Browse files
app.py
CHANGED
@@ -47,6 +47,7 @@ def read_status():
|
|
47 |
def run_ml_worker(url, api_key, hf_token):
|
48 |
global ml_worker, previous_url
|
49 |
previous_url = url
|
|
|
50 |
ml_worker = subprocess.Popen(
|
51 |
[
|
52 |
"giskard", "worker", "start",
|
@@ -74,6 +75,9 @@ def start_ml_worker(url, api_key, hf_token):
|
|
74 |
if not url or len(url) < 1:
|
75 |
return "Please provide URL of Giskard"
|
76 |
|
|
|
|
|
|
|
77 |
# Always run an external ML worker
|
78 |
stop_ml_worker()
|
79 |
|
|
|
47 |
def run_ml_worker(url, api_key, hf_token):
|
48 |
global ml_worker, previous_url
|
49 |
previous_url = url
|
50 |
+
subprocess.run(["giskard", "worker", "stop"])
|
51 |
ml_worker = subprocess.Popen(
|
52 |
[
|
53 |
"giskard", "worker", "start",
|
|
|
75 |
if not url or len(url) < 1:
|
76 |
return "Please provide URL of Giskard"
|
77 |
|
78 |
+
if ml_worker is not None:
|
79 |
+
return f"ML worker is still running for {previous_url}"
|
80 |
+
|
81 |
# Always run an external ML worker
|
82 |
stop_ml_worker()
|
83 |
|