Explorar el Código

fix threading arguments

master
Jeong Geol Kim hace 4 años
padre
commit
a64f4236b5
Se han modificado 1 ficheros con 4 adiciones y 3 borrados
  1. 4
    3
      auto_extract.py

+ 4
- 3
auto_extract.py Ver fichero

@@ -7,8 +7,9 @@ import threading
7 7
 
8 8
 hdd_root = '/hdd/*'
9 9
 
10
-def cmd_run(shell_cmd):
11
-    os.system(str(shell_cmd))
10
+def cmd_run(index, shell_cmd):
11
+    sh = shell_cmd[index]
12
+    os.system(sh)
12 13
 
13 14
 def main():
14 15
     surgery_list = glob.glob(hdd_root)
@@ -35,7 +36,7 @@ def main():
35 36
                     f.close()
36 37
                     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 38
                     for index in range(0, len(cmd_list)):
38
-                        thread_list.append(threading.Thread(target=cmd_run,args=cmd_list[index]))
39
+                        thread_list.append(threading.Thread(target=cmd_run,args=(index,cmd_list)))
39 40
                         thread_list[index].start()                    
40 41
                     f = open(file, 'at')
41 42
                     r_time = time.ctime(time.time())

Loading…
Cancelar
Guardar