Some more fixes to MVP

This commit is contained in:
2025-07-22 14:13:01 +02:00
parent 6137b63d07
commit 33f18ba9f0
3 changed files with 7 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ from caproto.sync.client import read, write
def read_config():
root_dir = os.path.dirname(__file__)
with open(root_dir + "config.yaml", "r") as f:
with open(root_dir + "/config.yaml", "r") as f:
return yaml.safe_load(f)

3
ioc/startioc.py Normal file → Executable file
View File

@@ -38,3 +38,6 @@ def startioc():
# Start the IOC itself
subprocess.run(root_dir + 'ioc/st.cmd')
if __name__ == __main__:
startioc()

View File

@@ -14,13 +14,14 @@ TIMEOUT_READ = 3.0
def prepare_ioc():
config = read_config()
pvprefix = config['pvprefix']
"""
This function checks if the test IOC is already running and attempts to
start it, if that is not the case.
"""
try:
read(f'{config['pvprefix']}:IOCREADY', timeout=TIMEOUT_READ)
read(f'{pvprefix}:IOCREADY', timeout=TIMEOUT_READ)
# Reading the check recird was successfull -> We assume that the IOC
# is running
@@ -33,7 +34,7 @@ def prepare_ioc():
now = time.time()
while now + TIMEOUT_IOC_STARTUP < time.time():
try:
read(f'{config['pvprefix']}:IOCREADY', timeout=TIMEOUT_READ)
read(f'{pvprefix}:IOCREADY', timeout=TIMEOUT_READ)
return
except TimeoutError:
time.sleep(0.5)