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.

detect_new_folder.py 910B

1234567891011121314151617181920212223
  1. import os
  2. import time
  3. name_time_list = []
  4. target_dir = '/home/mc365/data/dummy'
  5. while True:
  6. time.sleep(60)
  7. root_path = "/home/mc365/data/"
  8. filenames = os.listdir(root_path)
  9. for f in filenames:
  10. w_time = os.path.getctime(root_path + f)
  11. name_time_list.append((f, w_time))
  12. sorted_list = sorted(name_time_list, key=lambda x: x[1], reverse=True)
  13. recent_file = sorted_list[0]
  14. tmp_recent = str(root_path) + str(recent_file[0])
  15. if target_dir != tmp_recent:
  16. time.sleep(5)
  17. command = 'docker run --rm --name mail_recorder --gpus '"device=1"' -v /dev:/dev -v /home/mc365/sources:/sources -v /home/mc365/data/'+str(recent_file[0])+':/data/'+str(recent_file[0])+' stereolabs/zed:3.5-gl-devel-cuda11.1-ubuntu18.04 python3 /sources/recorder.py.bak'
  18. os.system(str(command))
  19. target_dir = str(root_path) + str(recent_file[0])