Compare commits
No commits in common. "main" and "test2" have entirely different histories.
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"hw": "intel",
|
|
||||||
"cpu": 12,
|
|
||||||
"memory": 32,
|
|
||||||
"gpu": "2080TI"
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@
|
||||||
Description=awx-perfermance
|
Description=awx-perfermance
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/python3 /usr/local/sdt/app/appName/main.py -config appName
|
ExecStart=/home/sdt/miniconda3/bin/python3 /usr/local/sdt/app/appName/main.py -config appName
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"topic": "performance",
|
|
||||||
"id": "sdt",
|
|
||||||
"password": "11223344",
|
|
||||||
"host": {
|
|
||||||
"address": "192.168.100.200",
|
|
||||||
"hostname": "sdt"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1 @@
|
||||||
|
topic: perfermance
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
sudo sed -i "s/appName/$1/g" /usr/local/sdt/app/$1/awx-perfermance.service
|
sudo sed -i "s/appName/$1/g" /usr/local/sdt/app/$1/awx-perfermance.service
|
||||||
sudo cp /usr/local/sdt/app/$1/awx-perfermance.service /etc/systemd/system/$1.service
|
sudo cp /usr/local/sdt/app/$1/awx-perfermance.service /etc/systemd/system/$1.service
|
||||||
sudo systemctl start $1
|
sudo systemctl start $1
|
||||||
|
|
16
main.py
16
main.py
|
@ -10,17 +10,15 @@ parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-config',help='')
|
parser.add_argument('-config',help='')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
with open(f'/usr/local/sdt/app/{args.config}/config.json', encoding='UTF-8') as f:
|
with open(f'/usr/local/sdt/app/{args.config}/config.yaml', encoding='UTF-8') as f:
|
||||||
# with open(f'./config.json', encoding='UTF-8') as f:
|
yamlData = yaml.load(f, Loader=yaml.FullLoader)
|
||||||
jsonData = json.load(f)
|
|
||||||
|
|
||||||
|
|
||||||
mqttc = mqtt.Client() # puclisher 이름
|
mqttc = mqtt.Client() # puclisher 이름
|
||||||
mqttc.username_pw_set("sdt", "251327")
|
mqttc.username_pw_set("sdt", "251327")
|
||||||
mqttc.connect("13.209.39.139", 32259)
|
mqttc.connect("13.209.39.139", 32259)
|
||||||
# f = open(f'/usr/local/sdt/app/{args.config}/text.txt')
|
|
||||||
while True:
|
while True:
|
||||||
# print(f"Config value: {yamlData['topic']}", flush=True)
|
|
||||||
dataList = []
|
dataList = []
|
||||||
for n in range(10):
|
for n in range(10):
|
||||||
data = {
|
data = {
|
||||||
|
@ -28,13 +26,13 @@ while True:
|
||||||
"data": [1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 4, 5, 6, 1],
|
"data": [1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 4, 5, 6, 1],
|
||||||
}
|
}
|
||||||
dataList.append(data)
|
dataList.append(data)
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
|
||||||
datas = json.dumps({
|
datas = json.dumps({
|
||||||
"assetCode":"",
|
"assetCode":"",
|
||||||
"timestamp":0,
|
"timestamp":0,
|
||||||
"dataType":"",
|
"dataType":"",
|
||||||
"data": dataList
|
"data": dataList
|
||||||
})
|
})
|
||||||
mqttc.publish(f"/sdt-cloud/{jsonData['topic']}", datas) # topic, message
|
mqttc.publish(f"/device-test/{yamlData['topic']}", datas) # topic, message
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue