bec-ipython-client 3.80.0__py3-none-any.whl → 3.81.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PKG-INFO +1 -1
- bec_ipython_client/main.py +10 -5
- {bec_ipython_client-3.80.0.dist-info → bec_ipython_client-3.81.0.dist-info}/METADATA +1 -1
- {bec_ipython_client-3.80.0.dist-info → bec_ipython_client-3.81.0.dist-info}/RECORD +10 -10
- pyproject.toml +1 -1
- tests/client_tests/test_bec_client.py +6 -6
- tests/end-2-end/test_scans_e2e.py +4 -4
- tests/end-2-end/test_scans_lib_e2e.py +10 -8
- {bec_ipython_client-3.80.0.dist-info → bec_ipython_client-3.81.0.dist-info}/WHEEL +0 -0
- {bec_ipython_client-3.80.0.dist-info → bec_ipython_client-3.81.0.dist-info}/entry_points.txt +0 -0
PKG-INFO
CHANGED
bec_ipython_client/main.py
CHANGED
|
@@ -13,6 +13,7 @@ import redis
|
|
|
13
13
|
import redis.exceptions
|
|
14
14
|
from IPython.terminal.ipapp import TerminalIPythonApp
|
|
15
15
|
from IPython.terminal.prompts import Prompts, Token
|
|
16
|
+
from pydantic import ValidationError
|
|
16
17
|
from rich.console import Console
|
|
17
18
|
from rich.panel import Panel
|
|
18
19
|
from rich.text import Text
|
|
@@ -30,6 +31,7 @@ from bec_lib.client import BECClient
|
|
|
30
31
|
from bec_lib.logger import bec_logger
|
|
31
32
|
from bec_lib.redis_connector import RedisConnector
|
|
32
33
|
from bec_lib.service_config import ServiceConfig
|
|
34
|
+
from bec_lib.utils.pydantic_pretty_print import pretty_print_pydantic_validation_error
|
|
33
35
|
|
|
34
36
|
logger = bec_logger.logger
|
|
35
37
|
|
|
@@ -213,16 +215,16 @@ class BECIPythonClient:
|
|
|
213
215
|
header.append("Alarm Raised\n", style="bold red")
|
|
214
216
|
header.append(f"Severity: {alarm.severity.name}\n", style="bold")
|
|
215
217
|
header.append(f"Type: {alarm.alarm_type}\n", style="bold")
|
|
216
|
-
if alarm.alarm.
|
|
217
|
-
header.append(f"Device: {alarm.alarm.
|
|
218
|
+
if alarm.alarm.info.device:
|
|
219
|
+
header.append(f"Device: {alarm.alarm.info.device}\n", style="bold")
|
|
218
220
|
|
|
219
221
|
console.print(Panel(header, title="Alarm Info", border_style="red", expand=False))
|
|
220
222
|
|
|
221
223
|
# --- SHOW SUMMARY
|
|
222
|
-
if alarm.alarm.
|
|
224
|
+
if alarm.alarm.info.compact_error_message:
|
|
223
225
|
console.print(
|
|
224
226
|
Panel(
|
|
225
|
-
Text(alarm.alarm.
|
|
227
|
+
Text(alarm.alarm.info.compact_error_message, style="yellow"),
|
|
226
228
|
title="Summary",
|
|
227
229
|
border_style="yellow",
|
|
228
230
|
expand=False,
|
|
@@ -230,7 +232,7 @@ class BECIPythonClient:
|
|
|
230
232
|
)
|
|
231
233
|
|
|
232
234
|
# --- SHOW FULL TRACEBACK
|
|
233
|
-
tb_str = alarm.alarm.
|
|
235
|
+
tb_str = alarm.alarm.info.error_message
|
|
234
236
|
if tb_str:
|
|
235
237
|
try:
|
|
236
238
|
console.print(tb_str)
|
|
@@ -248,6 +250,9 @@ def _ip_exception_handler(
|
|
|
248
250
|
evalue.pretty_print()
|
|
249
251
|
print("For more details, use 'bec.show_last_alarm()'")
|
|
250
252
|
return
|
|
253
|
+
if issubclass(etype, ValidationError):
|
|
254
|
+
pretty_print_pydantic_validation_error(evalue)
|
|
255
|
+
return
|
|
251
256
|
if issubclass(etype, (ScanInterruption, DeviceConfigError)):
|
|
252
257
|
print(f"\x1b[31m {evalue.__class__.__name__}:\x1b[0m {evalue}")
|
|
253
258
|
return
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
.gitignore,sha256=XxC6jyyftTo2CLtm4K8axuNPYwA9Wgaz2R93WhX8bTQ,3364
|
|
2
|
-
PKG-INFO,sha256=
|
|
2
|
+
PKG-INFO,sha256=2d37BamNTItClLaO5QzXRQhDpWANAs_P0zM0dwl2NlM,1052
|
|
3
3
|
demo.py,sha256=AquJB-0Tu2bIEFpcJ0Q3RUBt1xldqS6GgU5CjOAg_ww,7083
|
|
4
|
-
pyproject.toml,sha256=
|
|
4
|
+
pyproject.toml,sha256=Wsd2nSE2x4Mge794iyzctyIQiZkhU86ds3xup1gjGbA,1229
|
|
5
5
|
bec_ipython_client/__init__.py,sha256=ihd_V8I7Qo0MWKMo7bcvPf-ZyUQqkcNf8IAWLJKiFJE,79
|
|
6
6
|
bec_ipython_client/beamline_mixin.py,sha256=scMWIFbHJajyECzbwEVKyQUGjpqA9C_KiU2M6FuRH_Q,1067
|
|
7
7
|
bec_ipython_client/bec_magics.py,sha256=Rz2aXkUCeAV_VxdXqLUNHh8T44kSH9ha83OiEtdptzI,2792
|
|
8
8
|
bec_ipython_client/bec_startup.py,sha256=GGlHyxnSCQfYF5n-pYq2ic0pSyW5zvnT2PAlI5kY77w,1930
|
|
9
|
-
bec_ipython_client/main.py,sha256=
|
|
9
|
+
bec_ipython_client/main.py,sha256=XxSaiRuvDPKRzM3yuPz3FW5I0wnfyL2SgEfEG3VrDJg,13543
|
|
10
10
|
bec_ipython_client/prettytable.py,sha256=TnhGPGuU0XEvnIYJ1UfTEwadcowFW4rqJW8z_Sm0EDw,2534
|
|
11
11
|
bec_ipython_client/progressbar.py,sha256=aDKYjzXmGSwa82ewm59V8WSuqVQz9GiZPx5G65fEwpk,11090
|
|
12
12
|
bec_ipython_client/signals.py,sha256=mbThPo6h3mQ6RFRm9viETDMC_unFa7QxiymCdM_ZK7U,4194
|
|
@@ -28,7 +28,7 @@ bec_ipython_client/plugins/flomni/flomni_config.yaml,sha256=bCN1VKCzF6tw24HYeUE2
|
|
|
28
28
|
tests/conftest.py,sha256=4yzGYqs8EVOxxY9Bu-yGbzmOpzG9dxs3cwSCzjmRziQ,233
|
|
29
29
|
tests/client_tests/conftest.py,sha256=dUvYqvl6wogxN-kRCUuo_Uzna3P2uSYD7qGHyMGBlPY,413
|
|
30
30
|
tests/client_tests/test_beamline_mixins.py,sha256=8Ws0bmzl2gSW0VuOVu80_JbYNb5Y-htchmrrptwjwDo,4611
|
|
31
|
-
tests/client_tests/test_bec_client.py,sha256=
|
|
31
|
+
tests/client_tests/test_bec_client.py,sha256=gks7IYoDDXpbkC_EGWQfKtH08Yig71PRZtleXFhkU8A,8903
|
|
32
32
|
tests/client_tests/test_device_progress.py,sha256=GEw2g8MQZnv5mxABEZlxBmaMpxVS33wogaYohFolDEs,2353
|
|
33
33
|
tests/client_tests/test_ipython_live_updates.py,sha256=HpA16Mx0WdseqlfP0FojlAd6VfvjnwAUReDkItZVYWs,6081
|
|
34
34
|
tests/client_tests/test_live_table.py,sha256=0EKgWOgDqpjN8fJEeAzoKNCwFneDEsUY2NfWQkxB6xc,18155
|
|
@@ -36,9 +36,9 @@ tests/client_tests/test_move_callback.py,sha256=bUCcWoz_tc-yRAtwmEUMrKE_qKwatop_
|
|
|
36
36
|
tests/client_tests/test_pretty_table.py,sha256=uQ-KPb3RXoCFE_t1IrpkT6kZAoqW7pFXxbFc445sX0Y,469
|
|
37
37
|
tests/end-2-end/_ensure_requirements_container.py,sha256=RT2a5cUZnXtMjJRlPImGzgyX-KJPLiav5WSp_l3wzv8,725
|
|
38
38
|
tests/end-2-end/test_procedures_e2e.py,sha256=xjczbB33Cf5pDLe1KWcalRRBrSxOQ3cbV3s3w3GsC_A,4922
|
|
39
|
-
tests/end-2-end/test_scans_e2e.py,sha256=
|
|
40
|
-
tests/end-2-end/test_scans_lib_e2e.py,sha256
|
|
41
|
-
bec_ipython_client-3.
|
|
42
|
-
bec_ipython_client-3.
|
|
43
|
-
bec_ipython_client-3.
|
|
44
|
-
bec_ipython_client-3.
|
|
39
|
+
tests/end-2-end/test_scans_e2e.py,sha256=GMStotxqu24794TxIFc55PCtOjuG2qbkmibcUj7r-DI,31069
|
|
40
|
+
tests/end-2-end/test_scans_lib_e2e.py,sha256=dqs0ojkyQWStIQbqABq9mQrjqQyE43gr37VPhxvQ8b8,19427
|
|
41
|
+
bec_ipython_client-3.81.0.dist-info/METADATA,sha256=2d37BamNTItClLaO5QzXRQhDpWANAs_P0zM0dwl2NlM,1052
|
|
42
|
+
bec_ipython_client-3.81.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
43
|
+
bec_ipython_client-3.81.0.dist-info/entry_points.txt,sha256=oQUXYY0jjD9ZvKPHwaGn2wkUIWpDZM8L4ixDA3RlBWE,53
|
|
44
|
+
bec_ipython_client-3.81.0.dist-info/RECORD,,
|
pyproject.toml
CHANGED
|
@@ -216,13 +216,13 @@ def test_bec_ipython_client_property_access(ipython_client):
|
|
|
216
216
|
|
|
217
217
|
def test_bec_ipython_client_show_last_alarm(ipython_client, capsys):
|
|
218
218
|
client = ipython_client
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
compact_msg="Test alarm",
|
|
219
|
+
error_info = messages.ErrorInfo(
|
|
220
|
+
error_message="This is a test alarm",
|
|
221
|
+
compact_error_message="Test alarm",
|
|
222
|
+
exception_type="TestAlarm",
|
|
223
|
+
device=None,
|
|
225
224
|
)
|
|
225
|
+
alarm_msg = messages.AlarmMessage(severity=Alarms.MAJOR, info=error_info)
|
|
226
226
|
client.alarm_handler = AlarmHandler(connector=mock.MagicMock())
|
|
227
227
|
client.alarm_handler.add_alarm(alarm_msg)
|
|
228
228
|
client._alarm_history.append(
|
|
@@ -737,12 +737,12 @@ def test_update_config(bec_ipython_client_fixture):
|
|
|
737
737
|
bec = bec_ipython_client_fixture
|
|
738
738
|
bec.metadata.update({"unit_test": "test_update_config"})
|
|
739
739
|
demo_config_path = os.path.join(os.path.dirname(configs.__file__), "demo_config.yaml")
|
|
740
|
-
config = bec.
|
|
740
|
+
config = bec.device_manager.config_helper._load_config_from_file(demo_config_path)
|
|
741
741
|
config.pop("samx")
|
|
742
|
-
bec.
|
|
742
|
+
bec.device_manager.config_helper.send_config_request(action="set", config=config)
|
|
743
743
|
assert "samx" not in bec.device_manager.devices
|
|
744
|
-
config = bec.
|
|
745
|
-
bec.
|
|
744
|
+
config = bec.device_manager.config_helper._load_config_from_file(demo_config_path)
|
|
745
|
+
bec.device_manager.config_helper.send_config_request(action="set", config=config)
|
|
746
746
|
|
|
747
747
|
|
|
748
748
|
@pytest.mark.timeout(100)
|
|
@@ -322,7 +322,9 @@ def test_config_reload(
|
|
|
322
322
|
num_devices = len(bec.device_manager.devices)
|
|
323
323
|
if raises_error:
|
|
324
324
|
with pytest.raises(DeviceConfigError):
|
|
325
|
-
bec.config.update_session_with_file(
|
|
325
|
+
bec.config.update_session_with_file(
|
|
326
|
+
runtime_config_file_path, force=True, validate=False
|
|
327
|
+
)
|
|
326
328
|
if deletes_config:
|
|
327
329
|
assert len(bec.device_manager.devices) == 0
|
|
328
330
|
elif disabled_device:
|
|
@@ -330,7 +332,7 @@ def test_config_reload(
|
|
|
330
332
|
else:
|
|
331
333
|
assert len(bec.device_manager.devices) == num_devices
|
|
332
334
|
else:
|
|
333
|
-
bec.config.update_session_with_file(runtime_config_file_path)
|
|
335
|
+
bec.config.update_session_with_file(runtime_config_file_path, force=True, validate=False)
|
|
334
336
|
assert len(bec.device_manager.devices) == 2
|
|
335
337
|
for dev in disabled_device:
|
|
336
338
|
assert bec.device_manager.devices[dev].enabled is False
|
|
@@ -375,7 +377,7 @@ def test_config_reload_with_describe_failure(bec_test_config_file_path, bec_clie
|
|
|
375
377
|
f.write(yaml.dump(config))
|
|
376
378
|
|
|
377
379
|
with pytest.raises(DeviceConfigError):
|
|
378
|
-
bec.config.update_session_with_file(runtime_config_file_path)
|
|
380
|
+
bec.config.update_session_with_file(runtime_config_file_path, force=True, validate=False)
|
|
379
381
|
|
|
380
382
|
assert len(bec.device_manager.devices) == 2
|
|
381
383
|
assert bec.device_manager.devices["eyefoc"].enabled is True
|
|
@@ -386,7 +388,7 @@ def test_config_reload_with_describe_failure(bec_test_config_file_path, bec_clie
|
|
|
386
388
|
f"e2e_test_hexapod_fail", messages.DeviceStatusMessage(device="hexapod", status=0)
|
|
387
389
|
)
|
|
388
390
|
|
|
389
|
-
bec.config.update_session_with_file(runtime_config_file_path)
|
|
391
|
+
bec.config.update_session_with_file(runtime_config_file_path, force=True)
|
|
390
392
|
assert len(bec.device_manager.devices) == 2
|
|
391
393
|
assert bec.device_manager.devices["eyefoc"].enabled is True
|
|
392
394
|
assert bec.device_manager.devices["hexapod"].enabled is True
|
|
@@ -412,13 +414,13 @@ def test_config_add_remove_device(bec_client_lib):
|
|
|
412
414
|
"readOnly": False,
|
|
413
415
|
}
|
|
414
416
|
}
|
|
415
|
-
bec.
|
|
417
|
+
bec.device_manager.config_helper.send_config_request(action="add", config=config)
|
|
416
418
|
with pytest.raises(DeviceConfigError) as config_error:
|
|
417
|
-
bec.
|
|
419
|
+
bec.device_manager.config_helper.send_config_request(action="add", config=config)
|
|
418
420
|
assert config_error.match("Device new_device already exists")
|
|
419
421
|
assert "new_device" in dev
|
|
420
422
|
|
|
421
|
-
bec.
|
|
423
|
+
bec.device_manager.config_helper.send_config_request(action="remove", config={"new_device": {}})
|
|
422
424
|
assert "new_device" not in dev
|
|
423
425
|
|
|
424
426
|
device_config_msg = bec.connector.get(MessageEndpoints.device_config())
|
|
@@ -429,7 +431,7 @@ def test_config_add_remove_device(bec_client_lib):
|
|
|
429
431
|
|
|
430
432
|
config["new_device"]["deviceClass"] = "ophyd_devices.doesnt_exist"
|
|
431
433
|
with pytest.raises(DeviceConfigError) as config_error:
|
|
432
|
-
bec.
|
|
434
|
+
bec.device_manager.config_helper.send_config_request(action="add", config=config)
|
|
433
435
|
assert config_error.match("module 'ophyd_devices' has no attribute 'doesnt_exist'")
|
|
434
436
|
assert "new_device" not in dev
|
|
435
437
|
assert "samx" in dev
|
|
File without changes
|
{bec_ipython_client-3.80.0.dist-info → bec_ipython_client-3.81.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|