-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbg_task_checker.py
51 lines (49 loc) · 1.69 KB
/
bg_task_checker.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def check_tasks():
import psutil
processes = [p.cmdline() for p in psutil.process_iter() if p.name().lower() in ['python.exe'] and 'bg_task_checker.py' not in p.cmdline()[1]]
#print(len(processes))
streamAcquisitionDummy2 = [0]*len(processes)
mechanical = [0]*len(processes)
detect = [0]*len(processes)
pylonFlask = [0]*len(processes)
for i in range(len(processes)):
if ("streamAcqusitionDummy2.py" in processes[i][1]):
streamAcquisitionDummy2[i] = True
elif("streamAcqusitionDummy2.py" not in processes[i][1]):
streamAcquisitionDummy2[i] = False
if ("mechanical.py" in processes[i][1]):
mechanical[i] = True
elif("mechanical.py" not in processes[i][1]):
mechanical[i] = False
if ("detect.py" in processes[i][1]):
detect[i] = True
elif("detect.py" not in processes[i][1]):
detect[i] = False
if ("pylonFlask.py" in processes[i][1]):
pylonFlask[i] = True
elif("pylonFlask.py" not in processes[i][1]):
pylonFlask[i] = False
if (True in streamAcquisitionDummy2):
streamAcquisitionDummy2 = True
else:
streamAcquisitionDummy2 = False
if (True in mechanical):
mechanical = True
else:
mechanical = False
if (True in detect):
detect = True
else:
detect = False
if (True in pylonFlask):
pylonFlask = True
else:
pylonFlask = False
return(streamAcquisitionDummy2, mechanical, detect, pylonFlask)
# import psutil
# print(psutil.cpu_percent(1))
# print(psutil.virtual_memory().percent)
# print(psutil.net_io_counters())
#
# import gpustat
# print(gpustat)