ソースを参照

commit detect new data/primarykey

master
Jeong Geol Kim 4年前
コミット
99d4a51351
1個のファイルの変更23行の追加0行の削除
  1. 23
    0
      detect_new_folder.py

+ 23
- 0
detect_new_folder.py ファイルの表示

@@ -0,0 +1,23 @@
1
+import os
2
+import time
3
+
4
+name_time_list = []
5
+target_dir = '/home/mc365/data/dummy'
6
+while True:
7
+    time.sleep(60)
8
+    root_path = "/home/mc365/data/"
9
+    filenames = os.listdir(root_path)
10
+    for f in filenames:
11
+        w_time = os.path.getctime(root_path + f)
12
+        name_time_list.append((f, w_time))
13
+    sorted_list = sorted(name_time_list, key=lambda x: x[1], reverse=True)
14
+    
15
+    
16
+    recent_file = sorted_list[0]
17
+    tmp_recent = str(root_path) + str(recent_file[0])
18
+    if target_dir != tmp_recent:
19
+        time.sleep(5)
20
+        command = 'docker run --rm --name mail_recorder --gpus 1 --privileged -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'
21
+        os.system(str(command))        
22
+    target_dir = str(root_path) + str(recent_file[0])    
23
+    

読み込み中…
キャンセル
保存