refactor: publish file location with successful and done

This commit is contained in:
2024-06-06 15:15:24 +02:00
parent 4e4ca325ab
commit fdfb6db84b
6 changed files with 9 additions and 18 deletions

View File

@@ -118,7 +118,7 @@ class Eiger9MSetup(CustomDetectorMixin):
"""Prepare the detector for scan"""
self.prepare_detector()
self.prepare_data_backend()
self.publish_file_location(done=False)
self.publish_file_location(done=False, successful=False)
self.arm_acquisition()
def prepare_detector(self) -> None:

View File

@@ -162,7 +162,7 @@ class FalconSetup(CustomDetectorMixin):
"""Prepare detector and backend for acquisition"""
self.prepare_detector()
self.prepare_data_backend()
self.publish_file_location(done=False)
self.publish_file_location(done=False, successful=False)
self.arm_acquisition()
def prepare_detector(self) -> None:

View File

@@ -103,7 +103,9 @@ class PilatusSetup(CustomDetectorMixin):
"""Stage the detector for scan"""
self.prepare_detector()
self.prepare_data_backend()
self.publish_file_location(done=False, metadata={"input_path": self.parent.filepath_raw})
self.publish_file_location(
done=False, successful=False, metadata={"input_path": self.parent.filepath_raw}
)
def prepare_detector(self) -> None:
"""

View File

@@ -239,7 +239,7 @@ def test_stage(
)
assert mock_det.cam.num_frames.get() == 1
mock_publish_file_location.assert_called_with(done=False)
mock_publish_file_location.assert_called_with(done=False, successful=False)
assert mock_det.cam.acquire.get() == 1
@@ -345,7 +345,6 @@ def test_stop_detector_backend(mock_det):
[
({"filepath": "test.h5", "successful": True, "done": False, "scan_id": "123"}),
({"filepath": "test.h5", "successful": False, "done": True, "scan_id": "123"}),
({"filepath": "test.h5", "successful": None, "done": True, "scan_id": "123"}),
],
)
def test_publish_file_location(mock_det, scaninfo):

View File

@@ -147,7 +147,7 @@ def test_stage(mock_det, scaninfo):
scaninfo["num_points"] * scaninfo["frames_per_trigger"]
)
mock_prep_data_backend.assert_called_once()
mock_publish_file_location.assert_called_once_with(done=False)
mock_publish_file_location.assert_called_once_with(done=False, successful=False)
mock_arm_acquisition.assert_called_once()
@@ -193,7 +193,6 @@ def test_prepare_data_backend(mock_det, scaninfo):
[
({"filepath": "test.h5", "successful": True, "done": False, "scan_id": "123"}),
({"filepath": "test.h5", "successful": False, "done": True, "scan_id": "123"}),
({"filepath": "test.h5", "successful": None, "done": True, "scan_id": "123"}),
],
)
def test_publish_file_location(mock_det, scaninfo):

View File

@@ -115,8 +115,8 @@ def test_stage(mock_det, scaninfo, stopped, expected_exception):
)
assert mock_det.cam.num_frames.get() == 1
mock_publish_file_location.assert_called_with(
done=False, metadata={"input_path": path}
mock_publish_file_location.assert_called_once_with(
done=False, successful=False, metadata={"input_path": path}
)
@@ -159,15 +159,6 @@ def test_update_readout_time(mock_det, readout_time, expected_value):
"scan_id": "123",
}
),
(
{
"filepath": "test.h5",
"filepath_raw": "test5_raw.h5",
"successful": None,
"done": True,
"scan_id": "123",
}
),
],
)
def test_publish_file_location(mock_det, scaninfo):