Some more fixes to MVP
This commit is contained in:
@@ -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
3
ioc/startioc.py
Normal file → Executable file
@@ -38,3 +38,6 @@ def startioc():
|
||||
|
||||
# Start the IOC itself
|
||||
subprocess.run(root_dir + 'ioc/st.cmd')
|
||||
|
||||
if __name__ == __main__:
|
||||
startioc()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user