mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
9.2.0.rc (#1232)
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 3s
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 3s
* Python module is now built using scikit-build-core: Dev/scikitbuild #1164 * slsdet is available on PyPI from this release onwards * Fixed broken import in typecaster.h #1181 * Dev/automate version number #1193 * Dev/automate version part2 #1209 * 9111: added expat to host section to fix conda #1216 * fix for gotthard.py to import slsdet properly * added slsFramesynchronizer to conda copy_lib.sh * version of release * update version of client * removed cmake <=3.28 that was added in 9.1.11 (main_library in meta.yaml in conda-recipes) * added slsFrameSynchronizer binary to conda * added numpy dependency to toml * added documentation for pip in installation Detailed Commits: * skeleton pyproject.toml * moved compiled extension into slsdet * WIP * WI{ * separated the recipes * restored comments, cleanup * cleaned meta yaml * added back some python versions * conda build of main library * fixed typo * removed conda build pin * added zlib * added workflow for python lib * patching libzmq and cleaned up cmake * removed compiler version * switched patch tool * reverted to scikit-build in pyproject.toml * added sls_detector bin * added sync, renamed action * update cmake<=3.28 in conda build requirements * Fixed broken import in typecaster.h (#1181) - Fixed the broken import _slsdet --> slsdet._slsdet caused by a previous upgrade - added tests that exercises the conversion from python to C++ and from C++ to python - Python unit tests now run in CI (!) * removed 3.28 restriction on cmake in meta.yaml * from #1216 to 9.1.1.rc that got lost in merge from develoepr, added expat to host section to fix conda build * back with the cmake restriction * fixing gotthard1 import * version number automated for python build * mistakenly set version back to 0.0.0 * updated github workflow scripts to support automatic version numbering with environment variable * managed to load VERSION file in yaml file - simplifies things * saving changes in git workflow failed * got typo in github workflow * updatet regex pattern to support postfix * normalized version to PEP 440 specification in update_version.py * bug did not support version 0.0.0 * added regex pattern matching to version in toml file * version now supports . before postfix * updates api version based on version file & converted shell script files to python * updated all makefiles * adresses review comments * updated release version and the api lib version * raise an exception if the pull socket python script had errors at startup (for eg if pyzmq was not installed) * cmake<=3.28 not required anymore * updated documentation for pip installation as well * 920/add numpy (#1226) * added numpy dependency * aded build specifications for python version and platform * release notes --------- Co-authored-by: froejdh_e <erik.frojdh@psi.ch> Co-authored-by: Fröjd Lars Erik <froejdh_e@pcmoench03.psi.ch> Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com> Co-authored-by: mazzol_a <mazzol_a@pc17378.psi.ch> Co-authored-by: AliceMazzoleni99 <alice.mazzoleni@psi.ch>
This commit is contained in:
@ -20,6 +20,7 @@ from utils_for_test import (
|
||||
cleanSharedmemory,
|
||||
startProcessInBackground,
|
||||
startProcessInBackgroundWithLogFile,
|
||||
checkLogForErrors,
|
||||
startDetectorVirtualServer,
|
||||
loadConfig,
|
||||
ParseArguments
|
||||
@ -34,6 +35,9 @@ def startFrameSynchronizerPullSocket(name, fp):
|
||||
fname = PULL_SOCKET_PREFIX_FNAME + name + '.txt'
|
||||
cmd = ['python', '-u', 'frameSynchronizerPullSocket.py']
|
||||
startProcessInBackgroundWithLogFile(cmd, fp, fname)
|
||||
time.sleep(1)
|
||||
checkLogForErrors(fp, fname)
|
||||
|
||||
|
||||
|
||||
def startFrameSynchronizer(num_mods, fp):
|
||||
@ -44,16 +48,14 @@ def startFrameSynchronizer(num_mods, fp):
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def acquire(fp):
|
||||
def acquire(fp, det):
|
||||
Log(LogLevel.INFO, 'Acquiring')
|
||||
Log(LogLevel.INFO, 'Acquiring', fp)
|
||||
d = Detector()
|
||||
d.acquire()
|
||||
det.acquire()
|
||||
|
||||
|
||||
def testFramesCaught(name, num_frames):
|
||||
d = Detector()
|
||||
fnum = d.rx_framescaught[0]
|
||||
def testFramesCaught(name, det, num_frames):
|
||||
fnum = det.rx_framescaught[0]
|
||||
if fnum != num_frames:
|
||||
raise RuntimeException(f"{name} caught only {fnum}. Expected {num_frames}")
|
||||
|
||||
@ -61,7 +63,7 @@ def testFramesCaught(name, num_frames):
|
||||
Log(LogLevel.INFOGREEN, f'Frames caught test passed for {name}', fp)
|
||||
|
||||
|
||||
def testZmqHeadetTypeCount(name, num_mods, num_frames, fp):
|
||||
def testZmqHeadetTypeCount(name, det, num_mods, num_frames, fp):
|
||||
|
||||
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}")
|
||||
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}", fp)
|
||||
@ -88,8 +90,7 @@ def testZmqHeadetTypeCount(name, num_mods, num_frames, fp):
|
||||
continue
|
||||
|
||||
# test if file contents matches expected counts
|
||||
d = Detector()
|
||||
num_ports_per_module = 1 if name == "gotthard2" else d.numinterfaces
|
||||
num_ports_per_module = 1 if name == "gotthard2" else det.numinterfaces
|
||||
total_num_frame_parts = num_ports_per_module * num_mods * num_frames
|
||||
for htype, expected_count in [("header", num_mods), ("series_end", num_mods), ("module", total_num_frame_parts)]:
|
||||
if htype_counts[htype] != expected_count:
|
||||
@ -111,10 +112,10 @@ def startTestsForAll(args, fp):
|
||||
startDetectorVirtualServer(server, args.num_mods, fp)
|
||||
startFrameSynchronizerPullSocket(server, fp)
|
||||
startFrameSynchronizer(args.num_mods, fp)
|
||||
loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=args.num_mods, num_frames=args.num_frames)
|
||||
acquire(fp)
|
||||
testFramesCaught(server, args.num_frames)
|
||||
testZmqHeadetTypeCount(server, args.num_mods, args.num_frames, fp)
|
||||
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=args.num_mods, num_frames=args.num_frames)
|
||||
acquire(fp, d)
|
||||
testFramesCaught(server, d, args.num_frames)
|
||||
testZmqHeadetTypeCount(server, d, args.num_mods, args.num_frames, fp)
|
||||
Log(LogLevel.INFO, '\n')
|
||||
except Exception as e:
|
||||
raise RuntimeException(f'Synchronizer Tests failed') from e
|
||||
|
@ -104,7 +104,7 @@ def startProcessInBackground(cmd, fp):
|
||||
raise RuntimeException(f'Failed to start {cmd}:{str(e)}') from e
|
||||
|
||||
|
||||
def startProcessInBackgroundWithLogFile(cmd, fp, log_file_name):
|
||||
def startProcessInBackgroundWithLogFile(cmd, fp, log_file_name: str):
|
||||
Log(LogLevel.INFOBLUE, 'Starting up ' + ' '.join(cmd) + '. Log: ' + log_file_name)
|
||||
Log(LogLevel.INFOBLUE, 'Starting up ' + ' '.join(cmd) + '. Log: ' + log_file_name, fp)
|
||||
try:
|
||||
@ -114,6 +114,22 @@ def startProcessInBackgroundWithLogFile(cmd, fp, log_file_name):
|
||||
raise RuntimeException(f'Failed to start {cmd}:{str(e)}') from e
|
||||
|
||||
|
||||
def checkLogForErrors(fp, log_file_path: str):
|
||||
try:
|
||||
with open(log_file_path, 'r') as log_file:
|
||||
for line in log_file:
|
||||
if 'Error' in line:
|
||||
Log(LogLevel.ERROR, f"Error found in log: {line.strip()}")
|
||||
Log(LogLevel.ERROR, f"Error found in log: {line.strip()}", fp)
|
||||
raise RuntimeException("Error found in log file")
|
||||
except FileNotFoundError:
|
||||
print(f"Log file not found: {log_file_path}")
|
||||
raise
|
||||
except Exception as e:
|
||||
print(f"Exception while reading log: {e}")
|
||||
raise
|
||||
|
||||
|
||||
def runProcessWithLogFile(name, cmd, fp, log_file_name):
|
||||
Log(LogLevel.INFOBLUE, 'Running ' + name + '. Log: ' + log_file_name)
|
||||
Log(LogLevel.INFOBLUE, 'Running ' + name + '. Log: ' + log_file_name, fp)
|
||||
@ -142,7 +158,7 @@ def startDetectorVirtualServer(name :str, num_mods, fp):
|
||||
cmd = [name + 'DetectorServer_virtual', '-p', str(port_no)]
|
||||
if name == 'gotthard':
|
||||
cmd += ['-m', '1']
|
||||
startProcessInBackground(cmd, fp)
|
||||
startProcessInBackgroundWithLogFile(cmd, fp, "/tmp/virtual_det_" + name + str(i) + ".txt")
|
||||
match name:
|
||||
case 'jungfrau':
|
||||
time.sleep(7)
|
||||
@ -206,6 +222,8 @@ def loadConfig(name, rx_hostname, settingsdir, fp, num_mods = 1, num_frames = 1)
|
||||
d.frames = num_frames
|
||||
except Exception as e:
|
||||
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
|
||||
|
||||
return d
|
||||
|
||||
|
||||
def ParseArguments(description, default_num_mods=1):
|
||||
|
Reference in New Issue
Block a user