-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_updateLighting.py
28 lines (23 loc) · 1.32 KB
/
auto_updateLighting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
#几个bash命令,以及调用的.py文件内的bash命令,访问顺序是什么样的
#用于每日调用,更新model以及依赖文件
import sys
import os
from datetime import datetime
today=datetime.today()
print "begin at "+today.strftime('%Y-%m-%d %H:%M')
#scp dataset
if not os.path.exists('/data/pm25data/dataset/RNNPm25Dataset'+today.strftime('%Y%m%d')+'_t100p100shuffled.pkl.gz'):
os.system('scp [email protected]:/ldata/pm25data/pm25dataset/RNNPm25Dataset'+today.strftime('%Y%m%d')+'_t100p100shuffled.pkl.gz /data/pm25data/dataset/')
if not os.path.exists('/data/pm25data/dataset/RNNPm25Dataset'+today.strftime('%Y%m%d')+'_t100p100shuffled.pkl.gz'):
os.system('echo "Pm25 RNN Dataset file generating error!" | mail -s "caiyun pm25 alarm from lighting" "[email protected]"')
sys.exit(-1)
print "dataset downloaded"
#update model
os.system('python /home/suber/Git/RNN_pm25/model/Pm25RNN_MINIBATCH.py')
print "RNN model trained"
if not os.path.exists('/data/pm25data/model/RNNModel'+today.strftime('%Y%m%d')+'.pkl.gz'):
os.system('echo "Pm25 RNN model generating error!" | mail -s "caiyun pm25 alarm from lighting" "[email protected]"')
sys.exit(-1)
#scp
os.system('scp /data/pm25data/model/RNNModel'+today.strftime('%Y%m%d')+'.pkl.gz [email protected]:/ldata/pm25data/pm25model/')