From a55b7ab401f94d996a4e843cc3469ce084fe47dc Mon Sep 17 00:00:00 2001 From: castaneda Date: Fri, 21 Mar 2025 15:36:21 +0100 Subject: [PATCH] server that halts the execution of NNDy while running the experiment --- scripts/DA/newRun_NNDy.py | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 scripts/DA/newRun_NNDy.py diff --git a/scripts/DA/newRun_NNDy.py b/scripts/DA/newRun_NNDy.py new file mode 100644 index 0000000..49c3738 --- /dev/null +++ b/scripts/DA/newRun_NNDy.py @@ -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)