| 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: |