1
0
Fork 0
AWX_collector_dummy/AWX_shm_updater.py~

19 lines
398 B
Python
Raw Permalink Normal View History

2023-09-08 08:15:58 +00:00
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)