MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / run_simple_prep_env

Method run_simple_prep_env

class/projectModel/pythonModel.py:580–596  ·  view source on GitHub ↗
(self, project_id: int, project_conf: dict)

Source from the content-addressed store, hash-verified

578 return
579
580 def run_simple_prep_env(self, project_id: int, project_conf: dict) -> Tuple[bool, str]:
581 prep_pid_file = "{}/{}.pid".format(self._prep_path, project_conf["pjname"])
582 if os.path.exists(prep_pid_file):
583 pid = public.readFile(prep_pid_file)
584 try:
585 ps = psutil.Process(int(pid))
586 if ps.is_running():
587 return False, "项目准备中,不能再次开启准备"
588 except:
589 pass
590 os.remove(prep_pid_file)
591
592 tmp_sh = "nohup {}/pyenv/bin/python3 {}/script/py_project_env.py {} &> /dev/null & \necho $! > {}".format(
593 self._panel_path, self._panel_path, project_id, prep_pid_file
594 )
595 res = public.ExecShell(tmp_sh)
596 return True, ""
597
598 def prep_status(self, project_conf: dict):
599 try:

Callers 2

re_prep_envMethod · 0.95
CreateProjectMethod · 0.95

Calls 6

readFileMethod · 0.80
ExecShellMethod · 0.80
formatMethod · 0.45
existsMethod · 0.45
is_runningMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected