Skip to content

Commit 8b36dcf

Browse files
committed
add exception back for instlist
1 parent 964032d commit 8b36dcf

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

installation_and_upgrade/ibex_install_utils/ca_utils.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,12 @@ def get_machine_details_from_identifier(
124124
# then find the first match where pvPrefix equals the machine identifier
125125
# that's been passed to this function if it is not found instrument_details will be None
126126
instrument_details = None
127-
input_list = caget("CS:INSTLIST").tobytes().decode().rstrip('\x00')
128-
if input_list is not None:
129-
assert isinstance(input_list, str | bytes)
130-
instrument_list = dehex_decompress_and_dejson(input_list)
127+
try:
128+
instrument_list = dehex_decompress_and_dejson(caget("CS:INSTLIST").tobytes().decode().rstrip('\x00'))
131129
instrument_details = next(
132130
(inst for inst in instrument_list if inst["pvPrefix"] == machine_identifier), None
133131
)
134-
else:
132+
except AttributeError:
135133
print(
136134
"Error getting instlist, \nContinuing execution..."
137135
)
@@ -212,7 +210,11 @@ def get_blocks(self):
212210
Returns:
213211
A collection of blocks, or None if the PV was not connected
214212
"""
215-
blocks_hexed = caget(f"{self.prefix}CS:BLOCKSERVER:BLOCKNAMES").tobytes()
213+
try:
214+
blocks_hexed = caget(f"{self.prefix}CS:BLOCKSERVER:BLOCKNAMES").tobytes()
215+
except AttributeError as e:
216+
print("Error getting blocks.")
217+
raise e
216218
return literal_eval(FileUtils.dehex_and_decompress(blocks_hexed).decode())
217219

218220
def cget(self, block: str) -> Any:

installation_and_upgrade/instrument_deploy.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ if "%DETECT_OLD_GALIL%" == "YES" (
8181

8282
REM stop_ibex_server calls config_env which means we have to reactivate our venv
8383
call "%~dp0_activate_venv.bat"
84+
call "%~dp0set_epics_ca_addr_list.bat"
8485

8586
call python "%~dp0IBEX_upgrade.py" --release_dir "%SOURCE%" --release_suffix "%SUFFIX%" --server_arch %SERVER_ARCH% --confirm_step instrument_deploy_main
8687
IF %errorlevel% neq 0 exit /b %errorlevel%
@@ -90,6 +91,7 @@ start /i /wait cmd /c "%START_IBEX%"
9091

9192
REM start_ibex_server calls config_env which means we have to reactivate our venv
9293
call "%~dp0_activate_venv.bat"
94+
call "%~dp0set_epics_ca_addr_list.bat"
9395

9496
call python "%~dp0IBEX_upgrade.py" --release_dir "%SOURCE%" --release_suffix "%SUFFIX%" --server_arch %SERVER_ARCH% --confirm_step instrument_deploy_post_start
9597
call rmdir /s /q %UV_TEMP_VENV%

installation_and_upgrade/instrument_install.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ if %errorlevel% neq 0 goto ERROR
88

99
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
1010

11-
call "%~dp0set_epics_ca_addr_list.bat"
1211
call "%~dp0install_or_update_uv.bat"
1312
call "%~dp0set_up_venv.bat"
1413
if %errorlevel% neq 0 goto ERROR
@@ -39,6 +38,7 @@ IF EXIST "C:\Instrument\Apps\EPICS" (start /wait cmd /c "%STOP_IBEX%")
3938

4039
REM stop_ibex_server calls config_env which means we have to reactivate our venv
4140
call "%~dp0_activate_venv.bat"
41+
call "%~dp0set_epics_ca_addr_list.bat"
4242

4343
call python "%~dp0IBEX_upgrade.py" --release_dir "%SOURCE%" --release_suffix "%SUFFIX%" --server_arch %SERVER_ARCH% --confirm_step instrument_install
4444
if %errorlevel% neq 0 goto ERROR

0 commit comments

Comments
 (0)