fix: report user friendly error on attempted file overwrite
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / test (3.13) (pull_request) Successful in 1m4s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m2s
CI / test-with-coverage (pull_request) Successful in 1m28s
CI / test (3.12) (pull_request) Successful in 1m55s
CI / coverage-analysis (pull_request) Failing after 8s
CI / lint (pull_request) Failing after 2m0s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 2m34s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 2m37s
CI / test (3.14) (pull_request) Successful in 3m32s

This commit is contained in:
David Perl
2026-08-28 10:04:39 +02:00
parent 19c612024d
commit 12096c21f5
5 changed files with 10 additions and 9 deletions
@@ -33,6 +33,7 @@ class RotationService:
if not self.ctx.deps.cfg.simulated_detector:
self.ctx.deps.jfjoch.wait_till_running(timeout=60.0)
jfjoch_status = self.ctx.deps.jfjoch
# The detector move (sa2dc) is non-blocking; ensure it has reached the
# requested distance before triggering the scan, so data is collected
# at the dtz already reported to JFJoch/DB.
+3 -1
View File
@@ -8,7 +8,7 @@ from typing import Concatenate, ParamSpec, TypeVar, final
import jfjoch_client
from aarecommon.config.beamline import get_jfjoch_url
from aarecommon.config.logger import setup_logger
from aarecommon.errors.exception_handler import JFJochCommunicationError
from aarecommon.errors.exception_handler import AareUserError, JFJochCommunicationError
from aarecommon.models.beamline import MXBeamline
from aarecommon.models.models import DAQStatusModel, FluorescenceSpectrumOutputModel
from aarecommon.models.raster_grid import RasterGridRequest
@@ -293,6 +293,8 @@ class JFJochWrapper:
)
return True
except Exception as e:
if "Output file already exists" in str(e):
raise AareUserError("JFJoch reports output file already exists! Change the filename or increment the run number.", critical=True) from e
raise self._jfjoch_error(
f"JFJoch wait until running returned an exception: {e}",
error=e,
@@ -189,7 +189,7 @@ class RotationDataCollectionPanel(ScanSettingsPanel):
if is_single_image:
r = RotationScanRequest(
file_prefix=str(add_screening_to_path(self._filename)) + "_" + secrets.token_hex(3),
file_prefix=str(add_screening_to_path(self._filename)),
start_omega_deg=self.start_angle.value,
incr_omega_deg=self.screening_image_angle.value,
wedge_omega_deg=screening_settings["omega_step_deg"],
@@ -201,7 +201,7 @@ class RotationDataCollectionPanel(ScanSettingsPanel):
)
else:
r = RotationScanRequest(
file_prefix=str(add_screening_to_path(self._filename)) + "_" + secrets.token_hex(3),
file_prefix=str(add_screening_to_path(self._filename)),
start_omega_deg=self.start_angle.value,
wedge_omega_deg=self.screening_image_angle.value,
incr_omega_deg=screening_settings["omega_step_deg"],
@@ -225,7 +225,7 @@ class RotationDataCollectionPanel(ScanSettingsPanel):
logger.error("Cannot run measurement because of check")
return
r = RotationScanRequest(
file_prefix=str(add_data_to_path(self._filename)) + "_" + secrets.token_hex(3),
file_prefix=str(add_data_to_path(self._filename)),
start_omega_deg=self.start_angle.value,
steps=self.image_number(),
incr_omega_deg=self.image_angle.value,
+1 -3
View File
@@ -402,16 +402,14 @@ class SimpleRotationSettingsPanel(QWidget):
d_tar=d_tar,
)
# logger.debug("updated labels")
if self._prev_params != self.parameters:
self._prev_params = self.parameters
self.parameters_changed.emit(self.parameters)
# logger.debug("emitted parameters")
@Slot()
def run_measurement(self):
r = RotationScanRequest(
file_prefix=str(add_data_to_path(self._filename)) + "_" + secrets.token_hex(3),
file_prefix=str(add_data_to_path(self._filename)),
start_omega_deg=self.start_angle_enter.value,
steps=self.n_images,
incr_omega_deg=self.image_angle_enter.value,
@@ -459,7 +459,7 @@ class RasterGridManager(QObject):
grid = RasterGridRequest(
dtz=ag.dtz,
transmission=ag.transmission,
file_prefix=ag.file_prefix + "_" + secrets.token_hex(3),
file_prefix=ag.file_prefix,
exp_time_s=ag.exp_time_s,
n_x=ag.n_x,
n_y=ag.n_y,
@@ -485,7 +485,7 @@ class RasterGridManager(QObject):
grid = RasterGridRequest(
dtz=ag.dtz,
transmission=ag.transmission,
file_prefix=ag.file_prefix + "_" + secrets.token_hex(3),
file_prefix=ag.file_prefix,
exp_time_s=ag.exp_time_s,
n_x=ag.n_x,
n_y=ag.n_y,