yujuanqin commited on
Commit
ef9c2a5
·
1 Parent(s): c95b373

fix app not running

Browse files
Files changed (1) hide show
  1. lib/app_runner.py +4 -1
lib/app_runner.py CHANGED
@@ -52,11 +52,12 @@ class AppRunner:
52
  ret = subprocess.run(f"tail -n 10 {log_file}", check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
53
  universal_newlines=True)
54
  if "Pipeline is ready" in ret.stdout:
55
- print(ret.stdout)
56
  return True
57
  # print(ret.stdout)
58
  print(f"app is not started yet, retry {i+1}...")
59
  time.sleep(interval)
 
 
60
  raise RuntimeError(f"app not started in {timeout}s")
61
 
62
  def stop(self):
@@ -71,6 +72,8 @@ class AppRunner:
71
  os.killpg(pgid, signal.SIGKILL)
72
  self.sub_proc.wait(timeout=10)
73
  print("进程组已被强制杀死。")
 
 
74
 
75
  if __name__ == '__main__':
76
  app = AppRunner(RunType.code)
 
52
  ret = subprocess.run(f"tail -n 10 {log_file}", check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
53
  universal_newlines=True)
54
  if "Pipeline is ready" in ret.stdout:
 
55
  return True
56
  # print(ret.stdout)
57
  print(f"app is not started yet, retry {i+1}...")
58
  time.sleep(interval)
59
+ print(ret.stdout)
60
+ self.stop()
61
  raise RuntimeError(f"app not started in {timeout}s")
62
 
63
  def stop(self):
 
72
  os.killpg(pgid, signal.SIGKILL)
73
  self.sub_proc.wait(timeout=10)
74
  print("进程组已被强制杀死。")
75
+ except Exception as e:
76
+ print("停止进程失败:", e)
77
 
78
  if __name__ == '__main__':
79
  app = AppRunner(RunType.code)