-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunnner.py
29 lines (22 loc) · 823 Bytes
/
runnner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import subprocess
from gevent import subprocess as g_sub
from scripts.log import lloger
class Runner:
lloger = lloger
def __init__(
self,
entrypoint_path: str,
return_result: bool = False,
save_result: bool = False,
wait_result: bool = False,
):
self.entrypoint_path = entrypoint_path
self.return_result = return_result
self.save_result = save_result
self.wait_result = wait_result
print(f"Runner INIT: {self.entrypoint_path, self.wait_result}")
def run(self):
if not self.wait_result:
execution_proc: g_sub.Popen = subprocess.Popen(self.entrypoint_path, shell=True) # type: ignore
else:
execution_proc = subprocess.Popen(self.entrypoint_path, shell=True).wait() # type: ignore