Repository for M.A.I.L system's analysis server.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

auto_extract.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import os
  2. import sys
  3. import glob
  4. import time
  5. hdd_root = '/hdd/*'
  6. def main():
  7. surgery_list = glob.glob(hdd_root)
  8. for id in surgery_list:
  9. if 'lost+found' in id:
  10. surgery_list.remove(id)
  11. else:
  12. pass
  13. for id in surgery_list:
  14. file_list=glob.glob(id + '/*')
  15. for file in file_list:
  16. if 'log.txt' in file:
  17. f = open(file, 'rt')
  18. logs = f.readlines()
  19. f.close()
  20. if len(logs) == 2:
  21. f = open(file, 'at')
  22. r_time = time.ctime(time.time())
  23. f.write('exectue is successfully starts at ' + str(r_time) + '\n')
  24. f.close()
  25. 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')
  26. 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')
  27. f = open(file, 'at')
  28. r_time = time.ctime(time.time())
  29. f.write('exectue is successfully ends at ' + str(r_time) + '\n')
  30. f.close()
  31. else:
  32. pass
  33. if __name__ == '__main__':
  34. while True:
  35. main()