From 280155b92c4d6da2129fe75046c92bcb0db106c7 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Fri, 13 Feb 2026 09:18:39 +0000 Subject: [PATCH 1/5] If atlas not in visit, determine expected path --- src/murfey/client/context.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/murfey/client/context.py b/src/murfey/client/context.py index f17398909..d7abc2ffa 100644 --- a/src/murfey/client/context.py +++ b/src/murfey/client/context.py @@ -89,9 +89,18 @@ def ensure_dcg_exists( if not windows_path: logger.warning("No atlas metadata path found") return None - visit_index = windows_path.split("\\").index(environment.visit) - partial_path = "/".join(windows_path.split("\\")[visit_index + 1 :]) - logger.info("Partial Linux path successfully constructed from Windows path") + if environment.visit in windows_path.split("\\"): + # Case of atlas in the correct location + visit_index = windows_path.split("\\").index(environment.visit) + partial_path = "/".join(windows_path.split("\\")[visit_index + 1 :]) + logger.info( + f"Partial Linux path successfully constructed from Windows path: {partial_path}" + ) + else: + # Atlas not in visit, so come up with where it should have been + # Assumes /structure/to/Supervisor/Sample/Atlas/Atlas.dm + partial_path = "/".join(windows_path.split("\\")[-4:]) + logger.info(f"Partial Linux path estimated: {partial_path}") logger.info( f"Looking for atlas XML file in metadata directory {str((source_visit_dir / partial_path).parent)}" From cc72af3fdf5a10984d4c8661d8881fba9aa70347 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Fri, 13 Feb 2026 09:25:28 +0000 Subject: [PATCH 2/5] Do not crash analyser if dcg fails --- src/murfey/client/multigrid_control.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/murfey/client/multigrid_control.py b/src/murfey/client/multigrid_control.py index bfe4372ae..173e49273 100644 --- a/src/murfey/client/multigrid_control.py +++ b/src/murfey/client/multigrid_control.py @@ -566,12 +566,15 @@ def _start_dc(self, metadata_json): + "/".join(source.parts[-2:]) ) metadata_source = Path(metadata_source_as_str.replace("//", "/")) - ensure_dcg_exists( - collection_type="spa", - metadata_source=metadata_source, - environment=self._environment, - token=self.token, - ) + try: + ensure_dcg_exists( + collection_type="spa", + metadata_source=metadata_source, + environment=self._environment, + token=self.token, + ) + except Exception as e: + log.error(f"Failed to register data collection group: {e}") data = { "voltage": metadata_json["voltage"], "pixel_size_on_image": metadata_json["pixel_size_on_image"], From 399c7a9213417bd357a885bcb8739fffba147cd8 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Fri, 13 Feb 2026 12:01:27 +0000 Subject: [PATCH 3/5] Add rescaled initial model to database if it exists --- src/murfey/server/feedback.py | 56 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/murfey/server/feedback.py b/src/murfey/server/feedback.py index 66f4b2d03..279e2303c 100644 --- a/src/murfey/server/feedback.py +++ b/src/murfey/server/feedback.py @@ -1090,7 +1090,7 @@ def _downscaled_box_size( raise ValueError(f"Box size is too large: {box_size}") -def _resize_intial_model( +def _resize_initial_model( downscaled_box_size: int, downscaled_pixel_size: float, input_path: Path, @@ -1203,7 +1203,7 @@ def _register_3d_batch(message: dict, _db): / f"{provided_initial_model.stem}_rescaled_{pj_id}{provided_initial_model.suffix}" ) if not rescaled_initial_model_path.is_file(): - _resize_intial_model( + _resize_initial_model( *_downscaled_box_size( relion_options["particle_diameter"], relion_options["angpix"], @@ -1213,33 +1213,33 @@ def _register_3d_batch(message: dict, _db): machine_config.external_executables, machine_config.external_environment, ) - feedback_params.initial_model = str(rescaled_initial_model_path) - other_options["initial_model"] = str(rescaled_initial_model_path) - next_job = feedback_params.next_job - class3d_dir = ( - f"{class3d_message['class3d_dir']}{(feedback_params.next_job + 1):03}" - ) - feedback_params.next_job += 1 - _db.add(feedback_params) - _db.commit() + feedback_params.initial_model = str(rescaled_initial_model_path) + other_options["initial_model"] = str(rescaled_initial_model_path) + next_job = feedback_params.next_job + class3d_dir = ( + f"{class3d_message['class3d_dir']}{(feedback_params.next_job + 1):03}" + ) + feedback_params.next_job += 1 + _db.add(feedback_params) + _db.commit() - class3d_grp_uuid = _murfey_id(message["program_id"], _db)[0] - class_uuids = _murfey_id(message["program_id"], _db, number=4) - class3d_params = db.Class3DParameters( - pj_id=pj_id, - murfey_id=class3d_grp_uuid, - particles_file=class3d_message["particles_file"], - class3d_dir=class3d_dir, - batch_size=class3d_message["batch_size"], - ) - _db.add(class3d_params) - _db.commit() - _murfey_class3ds( - class_uuids, - class3d_message["particles_file"], - message["program_id"], - _db, - ) + class3d_grp_uuid = _murfey_id(message["program_id"], _db)[0] + class_uuids = _murfey_id(message["program_id"], _db, number=4) + class3d_params = db.Class3DParameters( + pj_id=pj_id, + murfey_id=class3d_grp_uuid, + particles_file=class3d_message["particles_file"], + class3d_dir=class3d_dir, + batch_size=class3d_message["batch_size"], + ) + _db.add(class3d_params) + _db.commit() + _murfey_class3ds( + class_uuids, + class3d_message["particles_file"], + message["program_id"], + _db, + ) if feedback_params.hold_class3d: # If waiting then save the message From 1995f4074750cc75ce4a37898aa39cb2c631e9fd Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Mon, 16 Feb 2026 13:38:34 +0000 Subject: [PATCH 4/5] Not supposed to be on this branch --- src/murfey/client/context.py | 15 +++------------ src/murfey/client/multigrid_control.py | 15 ++++++--------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/murfey/client/context.py b/src/murfey/client/context.py index d7abc2ffa..f17398909 100644 --- a/src/murfey/client/context.py +++ b/src/murfey/client/context.py @@ -89,18 +89,9 @@ def ensure_dcg_exists( if not windows_path: logger.warning("No atlas metadata path found") return None - if environment.visit in windows_path.split("\\"): - # Case of atlas in the correct location - visit_index = windows_path.split("\\").index(environment.visit) - partial_path = "/".join(windows_path.split("\\")[visit_index + 1 :]) - logger.info( - f"Partial Linux path successfully constructed from Windows path: {partial_path}" - ) - else: - # Atlas not in visit, so come up with where it should have been - # Assumes /structure/to/Supervisor/Sample/Atlas/Atlas.dm - partial_path = "/".join(windows_path.split("\\")[-4:]) - logger.info(f"Partial Linux path estimated: {partial_path}") + visit_index = windows_path.split("\\").index(environment.visit) + partial_path = "/".join(windows_path.split("\\")[visit_index + 1 :]) + logger.info("Partial Linux path successfully constructed from Windows path") logger.info( f"Looking for atlas XML file in metadata directory {str((source_visit_dir / partial_path).parent)}" diff --git a/src/murfey/client/multigrid_control.py b/src/murfey/client/multigrid_control.py index 173e49273..bfe4372ae 100644 --- a/src/murfey/client/multigrid_control.py +++ b/src/murfey/client/multigrid_control.py @@ -566,15 +566,12 @@ def _start_dc(self, metadata_json): + "/".join(source.parts[-2:]) ) metadata_source = Path(metadata_source_as_str.replace("//", "/")) - try: - ensure_dcg_exists( - collection_type="spa", - metadata_source=metadata_source, - environment=self._environment, - token=self.token, - ) - except Exception as e: - log.error(f"Failed to register data collection group: {e}") + ensure_dcg_exists( + collection_type="spa", + metadata_source=metadata_source, + environment=self._environment, + token=self.token, + ) data = { "voltage": metadata_json["voltage"], "pixel_size_on_image": metadata_json["pixel_size_on_image"], From 7e1f7d3bb7a56282d0e8285492b1235cb5857ac1 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Mon, 16 Feb 2026 13:55:59 +0000 Subject: [PATCH 5/5] next job is not needed --- src/murfey/server/feedback.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/murfey/server/feedback.py b/src/murfey/server/feedback.py index 279e2303c..cd69fdc79 100644 --- a/src/murfey/server/feedback.py +++ b/src/murfey/server/feedback.py @@ -1215,7 +1215,6 @@ def _register_3d_batch(message: dict, _db): ) feedback_params.initial_model = str(rescaled_initial_model_path) other_options["initial_model"] = str(rescaled_initial_model_path) - next_job = feedback_params.next_job class3d_dir = ( f"{class3d_message['class3d_dir']}{(feedback_params.next_job + 1):03}" )