new
This commit is contained in:
parent
10d67c039b
commit
a47ea039de
|
@ -0,0 +1,23 @@
|
|||
import numpy as np
|
||||
from multiprocessing import shared_memory
|
||||
import time
|
||||
import json
|
||||
import argparse
|
||||
|
||||
|
||||
existing_shm = shared_memory.SharedMemory(name="DO-shm")
|
||||
|
||||
c = np.ndarray((64,), dtype=np.int32, buffer=existing_shm.buf)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-config',help='')
|
||||
args = parser.parse_args()
|
||||
|
||||
ROOT_PATH = f"/usr/local/sdt/app/{args.config}"
|
||||
|
||||
while True:
|
||||
with open(f"{ROOT_PATH}/config.json", 'r') as file:
|
||||
jsonData = json.load(file)
|
||||
for n in range(64):
|
||||
c[n]=jsonData[str(n+1)]
|
||||
time.sleep(2)
|
|
@ -0,0 +1,18 @@
|
|||
import numpy as np
|
||||
from multiprocessing import shared_memory
|
||||
import time
|
||||
import json
|
||||
|
||||
|
||||
|
||||
existing_shm = shared_memory.SharedMemory(name="DO-shm")
|
||||
|
||||
c = np.ndarray((64,), dtype=np.int32, buffer=existing_shm.buf)
|
||||
|
||||
file_path = "./config.json"
|
||||
while True:
|
||||
with open(file_path, 'r') as file:
|
||||
jsonData = json.load(file)
|
||||
for n in range(64):
|
||||
c[n]=jsonData[str(n+1)]
|
||||
time.sleep(2)
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=awx_shm_updater
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/python3 /usr/local/sdt/app/appName/AWX_shm_updater.py -config appName
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=awx_collector
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/python3 /usr/local/sdt/app/appName/AWX_collector.py -config appName
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"1": 1,
|
||||
"2": 1,
|
||||
"3": 1,
|
||||
"4": 1,
|
||||
"5": 1,
|
||||
"6": 1,
|
||||
"7": 1,
|
||||
"8": 1,
|
||||
"9": 1,
|
||||
"10": 0,
|
||||
"11": 0,
|
||||
"12": 0,
|
||||
"13": 0,
|
||||
"14": 0,
|
||||
"15": 0,
|
||||
"16": 1,
|
||||
"17": 0,
|
||||
"18": 0,
|
||||
"19": 0,
|
||||
"20": 0,
|
||||
"21": 0,
|
||||
"22": 0,
|
||||
"23": 0,
|
||||
"24": 0,
|
||||
"25": 0,
|
||||
"26": 0,
|
||||
"27": 0,
|
||||
"28": 0,
|
||||
"29": 0,
|
||||
"30": 0,
|
||||
"31": 0,
|
||||
"32": 0,
|
||||
"33": 0,
|
||||
"34": 0,
|
||||
"35": 0,
|
||||
"36": 1,
|
||||
"37": 0,
|
||||
"38": 0,
|
||||
"39": 0,
|
||||
"40": 0,
|
||||
"41": 0,
|
||||
"42": 0,
|
||||
"43": 0,
|
||||
"44": 0,
|
||||
"45": 0,
|
||||
"46": 1,
|
||||
"47": 0,
|
||||
"48": 0,
|
||||
"49": 0,
|
||||
"50": 0,
|
||||
"51": 0,
|
||||
"52": 0,
|
||||
"53": 0,
|
||||
"54": 0,
|
||||
"55": 0,
|
||||
"56": 1,
|
||||
"57": 0,
|
||||
"58": 0,
|
||||
"59": 0,
|
||||
"60": 0,
|
||||
"61": 0,
|
||||
"62": 0,
|
||||
"63": 0,
|
||||
"64": 0
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
pip install -r requirements.txt
|
||||
sudo sed -i "s/appName/$1/g" /usr/local/sdt/app/$1/AWX_collector.service
|
||||
sudo cp /usr/local/sdt/app/$1/AWX_collector.service /etc/systemd/system/$1.service
|
||||
|
||||
sudo cp /usr/local/sdt/app/$1/AWX_shm_updater.service /etc/systemd/system/AWX_shm_updater.service
|
||||
sudo systemctl start $1
|
||||
sudo systemctl enable $1
|
|
@ -0,0 +1,18 @@
|
|||
import numpy as np
|
||||
from multiprocessing import shared_memory
|
||||
import time
|
||||
import json
|
||||
|
||||
|
||||
|
||||
existing_shm = shared_memory.SharedMemory(name="do_shm2")
|
||||
|
||||
c = np.ndarray((32,), dtype=np.int32, buffer=existing_shm.buf)
|
||||
|
||||
file_path = "./config.json"
|
||||
while True:
|
||||
with open(file_path, 'r') as file:
|
||||
jsonData = json.load(file)
|
||||
for n in range(32):
|
||||
c[n]=jsonData[str(n+1)]
|
||||
time.sleep(2)
|
Loading…
Reference in New Issue