Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def _process_queue(
if req_block.msg.scan_type in [
"open_scan_def",
"mv",
"_v4_mv",
]: # TODO: make this more general for all scan types that don't have report instructions
return True

Expand Down
6 changes: 4 additions & 2 deletions bec_ipython_client/bec_ipython_client/callbacks/live_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class LiveUpdatesTable(LiveUpdatesBase):

MAX_DEVICES = 10
REPORT_TYPE = "scan_progress"
STEP_SCAN_TYPES = {"step", "software_triggered", "hardware_triggered"}
FLY_SCAN_TYPES = {"fly"}

def __init__(
self,
Expand Down Expand Up @@ -118,9 +120,9 @@ def resume(self, request: messages.ScanQueueMessage, report_instruction: str, ca
@property
def devices(self):
"""get the devices for the callback"""
if self.point_data.metadata["scan_type"] == "step":
if self.point_data.metadata["scan_type"] in self.STEP_SCAN_TYPES:
return self.get_devices_from_scan_data(self.scan_item.live_data[0])
if self.point_data.metadata["scan_type"] == "fly":
if self.point_data.metadata["scan_type"] in self.FLY_SCAN_TYPES:
devices = list(self.point_data.content["data"].keys())
if len(devices) > self.MAX_DEVICES:
return devices[0 : self.MAX_DEVICES]
Expand Down
42 changes: 42 additions & 0 deletions bec_ipython_client/tests/client_tests/test_live_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,48 @@ def test_print_table_data(self, client_with_grid_scan):
live_update.print_table_data()
assert mock_client_msgs.called

def test_print_table_data_with_v4_software_triggered_scan(self, client_with_grid_scan):
client, request_msg = client_with_grid_scan
response_msg = messages.RequestResponseMessage(
accepted=True, message={"msg": ""}, metadata={"RID": "something"}
)
client.queue.request_storage.update_with_request(request_msg)
client.queue.request_storage.update_with_response(response_msg)
live_update = LiveUpdatesTable(
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
)
live_update.point_data = messages.ScanMessage(
point_id=0,
scan_id="",
data={"samx": {"samx": {"value": 0}}},
metadata={"scan_report_devices": ["samx"], "scan_type": "software_triggered"},
)
live_update.scan_item = ScanItemMock(live_data={0: live_update.point_data})
with mock.patch.object(live_update, "_print_client_msgs_asap") as mock_client_msgs:
live_update.print_table_data()
assert mock_client_msgs.called

def test_print_table_data_with_v4_hardware_triggered_scan(self, client_with_grid_scan):
client, request_msg = client_with_grid_scan
response_msg = messages.RequestResponseMessage(
accepted=True, message={"msg": ""}, metadata={"RID": "something"}
)
client.queue.request_storage.update_with_request(request_msg)
client.queue.request_storage.update_with_response(response_msg)
live_update = LiveUpdatesTable(
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
)
live_update.point_data = messages.ScanMessage(
point_id=0,
scan_id="",
data={"samx": {"samx": {"value": 0}}},
metadata={"scan_report_devices": ["samx"], "scan_type": "hardware_triggered"},
)
live_update.scan_item = ScanItemMock(live_data={0: live_update.point_data})
with mock.patch.object(live_update, "_print_client_msgs_asap") as mock_client_msgs:
live_update.print_table_data()
assert mock_client_msgs.called

def test_print_table_data_lamni_flyer(self, client_with_grid_scan):
client, request_msg = client_with_grid_scan
response_msg = messages.RequestResponseMessage(
Expand Down
Loading
Loading