inoki-giskard commited on
Commit
2ecd2bd
1 Parent(s): 29d69db

Use popen to have a reference on ML worker process

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -21,13 +21,15 @@ ml_worker = None
21
  def run_ml_worker(url, api_key, hf_token):
22
  global ml_worker, previous_url
23
  previous_url = url
24
- ml_worker = subprocess.run(
25
  [
26
  "giskard", "worker", "start",
27
  "-u", f"{url}", "-k", f"{api_key}", "-t", f"{hf_token}"
28
  ],
29
  stdout=open(LOG_FILE, "w"), stderr=subprocess.STDOUT
30
  )
 
 
31
 
32
 
33
  def stop_ml_worker():
 
21
  def run_ml_worker(url, api_key, hf_token):
22
  global ml_worker, previous_url
23
  previous_url = url
24
+ ml_worker = subprocess.Popen(
25
  [
26
  "giskard", "worker", "start",
27
  "-u", f"{url}", "-k", f"{api_key}", "-t", f"{hf_token}"
28
  ],
29
  stdout=open(LOG_FILE, "w"), stderr=subprocess.STDOUT
30
  )
31
+ args = ml_worker.args
32
+ print(f"Process {args} exited with {ml_worker.wait()}")
33
 
34
 
35
  def stop_ml_worker():