|
|
@@ -2,10 +2,14 @@ import os
|
|
2
|
2
|
import sys
|
|
3
|
3
|
import glob
|
|
4
|
4
|
import time
|
|
|
5
|
+import threading
|
|
5
|
6
|
|
|
6
|
7
|
|
|
7
|
8
|
hdd_root = '/hdd/*'
|
|
8
|
9
|
|
|
|
10
|
+def cmd_run(shell_cmd):
|
|
|
11
|
+ os.system(str(shell_cmd))
|
|
|
12
|
+
|
|
9
|
13
|
def main():
|
|
10
|
14
|
surgery_list = glob.glob(hdd_root)
|
|
11
|
15
|
|
|
|
@@ -16,19 +20,23 @@ def main():
|
|
16
|
20
|
pass
|
|
17
|
21
|
|
|
18
|
22
|
for id in surgery_list:
|
|
|
23
|
+
|
|
19
|
24
|
file_list=glob.glob(id + '/*')
|
|
20
|
25
|
for file in file_list:
|
|
21
|
26
|
if 'log.txt' in file:
|
|
22
|
27
|
f = open(file, 'rt')
|
|
23
|
28
|
logs = f.readlines()
|
|
24
|
|
- f.close()
|
|
|
29
|
+ f.close()
|
|
25
|
30
|
if len(logs) == 2:
|
|
|
31
|
+ thread_list = []
|
|
26
|
32
|
f = open(file, 'at')
|
|
27
|
33
|
r_time = time.ctime(time.time())
|
|
28
|
34
|
f.write('exectue is successfully starts at ' + str(r_time) + '\n')
|
|
29
|
35
|
f.close()
|
|
30
|
|
- os.system('docker run --rm --name extract_1 --gpus '"device=0"' -v /dev:/dev -v /home/mc365/sources:/sources -v /hdd:/hdd ellishuntingmoon/mailsys:0.4 python3 /sources/extract_01.py ' + id + '/ >> /dev/null')
|
|
31
|
|
- os.system('docker run --rm --name extract_2 --gpus '"device=1"' -v /dev:/dev -v /home/mc365/sources:/sources -v /hdd:/hdd ellishuntingmoon/mailsys:0.4 python3 /sources/extract_02.py ' + id + '/ >> /dev/null')
|
|
|
36
|
+ cmd_list = ['docker run --rm --name extract_1 --gpus '"device=0"' -v /dev:/dev -v /home/mc365/sources:/sources -v /hdd:/hdd ellishuntingmoon/mailsys:0.4 python3 /sources/extract_01.py ' + id + '/ >> /dev/null', 'docker run --rm --name extract_2 --gpus '"device=1"' -v /dev:/dev -v /home/mc365/sources:/sources -v /hdd:/hdd ellishuntingmoon/mailsys:0.4 python3 /sources/extract_02.py ' + id + '/ >> /dev/null']
|
|
|
37
|
+ for index in range(0, len(cmd_list)):
|
|
|
38
|
+ thread_list.append(threading.Thread(target=cmd_run,args=cmd_list))
|
|
|
39
|
+ thread_list[index].start()
|
|
32
|
40
|
f = open(file, 'at')
|
|
33
|
41
|
r_time = time.ctime(time.time())
|
|
34
|
42
|
f.write('exectue is successfully ends at ' + str(r_time) + '\n')
|