server that halts the execution of NNDy while running the experiment

This commit is contained in:
castaneda 2025-03-21 15:36:21 +01:00
parent d84103560e
commit a55b7ab401

47
scripts/DA/newRun_NNDy.py Normal file
View File

@ -0,0 +1,47 @@
import os, shutil, re, warnings, time
import threading
import socketserver
import zmq
import lyse
def send_message(message):
url = "tcp://" + str("127.0.0.1") + ":" + str(24325)
context = zmq.Context()
with context.socket(zmq.REQ) as client:
client.connect(url)
client.send_json(message)
msg = client.recv_json()
print("Send signal to NNDy.")
def send_to_ploting(hdf5files_path):
if not isinstance(hdf5files_path, str):
hdf5files_path = hdf5files_path.decode('utf-8')
fileName = hdf5files_path.split("\\")[-1]
sequenceName = '_'.join(fileName.split("_")[2:-1])
year = fileName.split("_")[0].split("-")[0]
month = fileName.split("_")[0].split("-")[1]
day = fileName.split("_")[0].split("-")[2]
shotName = fileName.split("_")[1]
runNum = fileName.split("_")[-1].split(".")[0]
runID = str(year + month + day + shotName + runNum)
msg = sequenceName + ',' + runID
send_message(msg)
if __name__ == '__main__':
df = lyse.data()
hdf5files_path = str(df.filepath.iloc[-1])
send_to_ploting(hdf5files_path)