ソースを参照

fetch when update

alpha
Jeong Geol Kim 4年前
コミット
728b479763
3個のファイルの変更20行の追加10行の削除
  1. 16
    7
      main.py
  2. 2
    1
      requirements.txt
  3. 2
    2
      settings.json

+ 16
- 7
main.py ファイルの表示

@@ -5,6 +5,7 @@ import time
5 5
 from datetime import datetime
6 6
 from tkinter import messagebox
7 7
 import os
8
+import git
8 9
 
9 10
 from paramiko import file
10 11
 import pymssql
@@ -43,7 +44,9 @@ def sshConnect(cs, sd):
43 44
     data_root_dir = './data/'+cs+sd
44 45
     stdin, stdout, stderr = ssh.exec_command('mkdir ' + data_root_dir)
45 46
     #TODO: 여기에 도커 명령어 및 동시 녹화 코드 입력
46
-    stdin, stdout, stderr = ssh.exec_command('docker run --rm --name mail_recorder --gpus 1 --privileged -v /dev:/dev -v /home/mc365/sources:/sources -v /home/mc365/data/'+cs+sd+':/data/'+cs+sd+' stereolabs/zed:3.5-gl-devel-cuda11.1-ubuntu18.04 python3 /sources/recorder.py')
47
+    cmd = 'docker run --rm --name mail_recorder --gpus 1 --privileged -v /dev:/dev -v /home/mc365/sources:/sources -v /home/mc365/data/'+cs+sd+':/data/'+cs+sd+' stereolabs/zed:3.5-gl-devel-cuda11.1-ubuntu18.04 python3 /sources/rec_ubuntu.py'
48
+    print(cmd)
49
+    stdin, stdout, stderr = ssh.exec_command(cmd)
47 50
     f = open(filepath, 'w')
48 51
     r_time = time.ctime(time.time())
49 52
     f.write('record succesfully started at ' + str(r_time) + '\n')
@@ -75,11 +78,10 @@ def sshQuit(cs, sd):
75 78
 
76 79
     ssh = paramiko.SSHClient()
77 80
     ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
78
-    ssh.connect(settings[4],port= settings[3], username=settings[5], password=settings[6])       
79
-    stdin, stdout, stderr = ssh.exec_command('docker stop mail_recorder')
80
-    time.sleep(10)
81
-    stdin, stdout, stderr = ssh.exec_command('mv ' + data_root_dir + ' /hdd/')
82
-
81
+    ssh.connect(settings[4],port= settings[3], username=settings[5], password=settings[6])
82
+    t = ssh.get_transport()
83
+    c = t.open_session()
84
+    c.exec_command('docker stop mail_recorder && mv ' + data_root_dir + ' /hdd/')   
83 85
         
84 86
 
85 87
 
@@ -159,4 +161,11 @@ entry_customer_code.pack()
159 161
 
160 162
 button_confirm.pack()
161 163
 
162
-window.mainloop()
164
+if __name__ == "__main__":
165
+    lastmod = int(os.path.getmtime('./main.py'))
166
+    print(lastmod)
167
+    os.system('git clone -b alpha https://git.apl.hongik.ac.kr/Ellis/mailsys_client.git')
168
+    if lastmod != int(os.path.getmtime('./main.py')):
169
+        pass
170
+    else:
171
+        window.mainloop()

+ 2
- 1
requirements.txt ファイルの表示

@@ -1 +1,2 @@
1
-paramiko==2.7.2
1
+paramiko==2.7.2
2
+GitPython==3.1.18

+ 2
- 2
settings.json ファイルの表示

@@ -2,8 +2,8 @@
2 2
     "window_name":"365mc M.A.I.L system Recorder",
3 3
     "window_position": "240x240+300+300",
4 4
     "branch_location": "서울",
5
-    "surgery_room_number": 803,
6
-    "ddns": "mailsys36.iptime.org",
5
+    "surgery_room_number": 1003,
6
+    "ddns": "mailsys36.asuscomm.com",
7 7
     "account": "mc365",
8 8
     "password": "tkadbrdhmc1!"
9 9
 }

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