Repository for M.A.I.L system's analysis server.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

auto_extract.py 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import os
  2. import sys
  3. import glob
  4. import time
  5. import threading
  6. hdd_root = '/hdd/*'
  7. def cmd_run(index, shell_cmd):
  8. sh = shell_cmd[index]
  9. os.system(sh)
  10. def main():
  11. surgery_list = glob.glob(hdd_root)
  12. for id in surgery_list:
  13. if 'lost+found' in id:
  14. surgery_list.remove(id)
  15. else:
  16. pass
  17. for id in surgery_list:
  18. file_list=glob.glob(id + '/*')
  19. for file in file_list:
  20. if 'log.txt' in file:
  21. f = open(file, 'rt')
  22. logs = f.readlines()
  23. f.close()
  24. if len(logs) == 2:
  25. thread_list = []
  26. f = open(file, 'at')
  27. r_time = time.ctime(time.time())
  28. f.write('exectue is successfully starts at ' + str(r_time) + '\n')
  29. f.close()
  30. 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']
  31. for index in range(0, len(cmd_list)):
  32. thread_list.append(threading.Thread(target=cmd_run,args=(index,cmd_list)))
  33. thread_list[index].start()
  34. f = open(file, 'at')
  35. r_time = time.ctime(time.time())
  36. f.write('exectue is successfully ends at ' + str(r_time) + '\n')
  37. f.close()
  38. else:
  39. pass
  40. if __name__ == '__main__':
  41. while True:
  42. main()