diff --git a/src/cryoemservices/services/cryolo.py b/src/cryoemservices/services/cryolo.py index 3444dac5..7d29b2bd 100644 --- a/src/cryoemservices/services/cryolo.py +++ b/src/cryoemservices/services/cryolo.py @@ -164,7 +164,7 @@ def cryolo(self, rw, header: dict, message: dict): return # Check job alias - job_alias = job_dir.parent / "Live_processing" + job_alias = job_dir.parent / "Live_cryolo" if not job_alias.exists(): job_alias.symlink_to(job_dir) elif not (job_alias.is_symlink() and job_alias.readlink() == job_dir): @@ -276,7 +276,7 @@ def cryolo(self, rw, header: dict, message: dict): "stdout": result.stdout.decode("utf8", "replace"), "stderr": result.stderr.decode("utf8", "replace"), "experiment_type": cryolo_params.experiment_type, - "alias": "Live_processing", + "alias": "Live_cryolo", } if ( result.returncode diff --git a/src/cryoemservices/services/ctffind.py b/src/cryoemservices/services/ctffind.py index 794b5a87..c6adcedd 100644 --- a/src/cryoemservices/services/ctffind.py +++ b/src/cryoemservices/services/ctffind.py @@ -173,7 +173,7 @@ def ctf_find(self, rw, header: dict, message: dict): job_alias = Path( re.sub( f"CtfFind/job{ctf_job_number:03}/.+", - "CtfFind/Live_processing/", + "CtfFind/Live_ctffind/", ctf_params.output_image, ) ) @@ -254,7 +254,7 @@ def ctf_find(self, rw, header: dict, message: dict): ), "stdout": result.stdout.decode("utf8", "replace"), "stderr": result.stderr.decode("utf8", "replace"), - "alias": "Live_processing", + "alias": "Live_ctffind", } if result.returncode: node_creator_parameters["success"] = False diff --git a/src/cryoemservices/services/extract_class.py b/src/cryoemservices/services/extract_class.py index 60a05a61..ef0d789a 100644 --- a/src/cryoemservices/services/extract_class.py +++ b/src/cryoemservices/services/extract_class.py @@ -107,7 +107,7 @@ def extract_class(self, rw, header: dict, message: dict): rw.transport.nack(header) return original_dir = Path(extract_params.class3d_dir).parent.parent - ctf_micrographs_file = "CtfFind/Live_processing/micrographs_ctf.star" + ctf_micrographs_file = "CtfFind/Live_ctffind/micrographs_ctf.star" # Link the required files and pull out necessary parameters particles_data = ( diff --git a/src/cryoemservices/services/motioncorr.py b/src/cryoemservices/services/motioncorr.py index 942a10dd..b53db5ab 100644 --- a/src/cryoemservices/services/motioncorr.py +++ b/src/cryoemservices/services/motioncorr.py @@ -316,7 +316,7 @@ def motion_correction(self, rw, header: dict, message: dict): job_alias = Path( re.sub( f"MotionCorr/job{job_number:03}/.+", - "MotionCorr/Live_processing/", + "MotionCorr/Live_motioncorr/", mc_params.mrc_out, ) ) @@ -526,7 +526,7 @@ def motion_correction(self, rw, header: dict, message: dict): "stdout": result.stdout.decode("utf8", "replace"), "stderr": result.stderr.decode("utf8", "replace"), "success": False, - "alias": "Live_processing", + "alias": "Live_motioncorr", } rw.send_to("node_creator", node_creator_parameters) rw.transport.nack(header) @@ -677,8 +677,8 @@ def motion_correction(self, rw, header: dict, message: dict): ) if not import_movie.parent.is_dir(): import_movie.parent.mkdir(parents=True) - if not (project_dir / "Import/Live_processing").exists(): - (project_dir / "Import/Live_processing").symlink_to( + if not (project_dir / "Import/Live_import").exists(): + (project_dir / "Import/Live_import").symlink_to( project_dir / f"Import/job{job_number - 1:03}" ) import_movie.unlink(missing_ok=True) @@ -693,7 +693,7 @@ def motion_correction(self, rw, header: dict, message: dict): "command": "", "stdout": "", "stderr": "", - "alias": "Live_processing", + "alias": "Live_import", } else: import_parameters = { @@ -705,7 +705,7 @@ def motion_correction(self, rw, header: dict, message: dict): "command": "", "stdout": "", "stderr": "", - "alias": "Live_processing", + "alias": "Live_import", } rw.send_to("node_creator", import_parameters) @@ -725,7 +725,7 @@ def motion_correction(self, rw, header: dict, message: dict): "early_motion": early_motion, "late_motion": late_motion, }, - "alias": "Live_processing", + "alias": "Live_motioncorr", } rw.send_to("node_creator", node_creator_parameters) # Remove tmp file after requesting node creation diff --git a/src/cryoemservices/services/topaz_pick.py b/src/cryoemservices/services/topaz_pick.py index 882e7b36..33cdb37f 100644 --- a/src/cryoemservices/services/topaz_pick.py +++ b/src/cryoemservices/services/topaz_pick.py @@ -113,7 +113,7 @@ def topaz(self, rw, header: dict, message: dict): job_alias = Path( re.sub( f"AutoPick/job{job_number:03}/.+", - "AutoPick/Live_processing/", + "AutoPick/Live_topaz_picking/", topaz_params.output_path, ) ) @@ -207,7 +207,7 @@ def topaz(self, rw, header: dict, message: dict): "command": " ".join(command), "stdout": "", "stderr": "", - "alias": "Live_processing", + "alias": "Live_topaz_picking", "success": True, } if not job_is_rerun: diff --git a/tests/services/test_cryolo_service.py b/tests/services/test_cryolo_service.py index 38c52ca4..2cc57698 100644 --- a/tests/services/test_cryolo_service.py +++ b/tests/services/test_cryolo_service.py @@ -119,8 +119,8 @@ def write_cbox_file(command, cwd, capture_output): ) # Check symlinks - assert (tmp_path / "AutoPick/Live_processing").is_symlink() - assert (tmp_path / "AutoPick/Live_processing").readlink() == ( + assert (tmp_path / "AutoPick/Live_cryolo").is_symlink() + assert (tmp_path / "AutoPick/Live_cryolo").readlink() == ( tmp_path / "AutoPick/job007" ) @@ -205,7 +205,7 @@ def write_cbox_file(command, cwd, capture_output): "stdout": "stdout", "stderr": "stderr", "experiment_type": "spa", - "alias": "Live_processing", + "alias": "Live_cryolo", "success": True, }, ) @@ -349,7 +349,7 @@ def test_cryolo_service_tomography(mock_subprocess, offline_transport, tmp_path) "stdout": "stdout", "stderr": "stderr", "experiment_type": "tomography", - "alias": "Live_processing", + "alias": "Live_cryolo", "success": True, }, ) @@ -469,13 +469,13 @@ def write_cbox_file(command, cwd, capture_output): offline_transport.ack.assert_called_once() # Case 2: ok symlink - assert (tmp_path / "AutoPick/Live_processing").is_symlink() + assert (tmp_path / "AutoPick/Live_cryolo").is_symlink() service.cryolo(None, header=header, message=cryolo_test_message) assert offline_transport.ack.call_count == 2 # Case 3: bad symlink - (tmp_path / "AutoPick/Live_processing").unlink() - (tmp_path / "AutoPick/Live_processing").symlink_to(tmp_path / "AutoPick") + (tmp_path / "AutoPick/Live_cryolo").unlink() + (tmp_path / "AutoPick/Live_cryolo").symlink_to(tmp_path / "AutoPick") service.cryolo(None, header=header, message=cryolo_test_message) offline_transport.nack.assert_called_once() diff --git a/tests/services/test_ctffind_service.py b/tests/services/test_ctffind_service.py index c3561839..80204193 100644 --- a/tests/services/test_ctffind_service.py +++ b/tests/services/test_ctffind_service.py @@ -106,8 +106,8 @@ def test_ctffind4_service_spa(mock_subprocess, offline_transport, tmp_path): ) # Check symlinks - assert (tmp_path / "CtfFind/Live_processing").is_symlink() - assert (tmp_path / "CtfFind/Live_processing").readlink() == ( + assert (tmp_path / "CtfFind/Live_ctffind").is_symlink() + assert (tmp_path / "CtfFind/Live_ctffind").readlink() == ( tmp_path / "CtfFind/job006" ) @@ -174,7 +174,7 @@ def test_ctffind4_service_spa(mock_subprocess, offline_transport, tmp_path): "command": f"ctffind\n{' '.join(map(str, parameters_list))}", "stdout": "stdout", "stderr": "stderr", - "alias": "Live_processing", + "alias": "Live_ctffind", "success": True, }, ) @@ -280,7 +280,7 @@ def test_ctffind5_service_tomo(mock_subprocess, offline_transport, tmp_path): "command": f"ctffind5\n{' '.join(map(str, parameters_list))}", "stdout": "stdout", "stderr": "stderr", - "alias": "Live_processing", + "alias": "Live_ctffind", "success": True, }, ) @@ -428,13 +428,13 @@ def test_ctffind5_service_check_symlinks(mock_subprocess, offline_transport, tmp offline_transport.ack.assert_called_once() # Case 2: ok symlink - assert (tmp_path / "CtfFind/Live_processing").is_symlink() + assert (tmp_path / "CtfFind/Live_ctffind").is_symlink() service.ctf_find(None, header=header, message=ctffind_test_message) assert offline_transport.ack.call_count == 2 # Case 3: bad symlink - (tmp_path / "CtfFind/Live_processing").unlink() - (tmp_path / "CtfFind/Live_processing").symlink_to(tmp_path / "CtfFind") + (tmp_path / "CtfFind/Live_ctffind").unlink() + (tmp_path / "CtfFind/Live_ctffind").symlink_to(tmp_path / "CtfFind") service.ctf_find(None, header=header, message=ctffind_test_message) offline_transport.nack.assert_called_once() @@ -523,7 +523,7 @@ def test_ctffind5_service_fail_cases(mock_subprocess, offline_transport, tmp_pat "command": mock.ANY, "stdout": "stdout", "stderr": "stderr", - "alias": "Live_processing", + "alias": "Live_ctffind", "success": False, }, ) diff --git a/tests/services/test_extract_class.py b/tests/services/test_extract_class.py index 09a4b0bf..329e4832 100644 --- a/tests/services/test_extract_class.py +++ b/tests/services/test_extract_class.py @@ -215,7 +215,7 @@ def test_extract_class_service(mock_requests, offline_transport, tmp_path): { "job_type": "relion.extract", "input_file": ( - f"CtfFind/Live_processing/micrographs_ctf.star" + f"CtfFind/Live_ctffind/micrographs_ctf.star" f"::{tmp_path}/Select/job011/particles.star" ), "output_file": f"{tmp_path}/Extract/job012/particles.star", diff --git a/tests/services/test_motioncorr_service.py b/tests/services/test_motioncorr_service.py index ab6645c7..4c6533df 100644 --- a/tests/services/test_motioncorr_service.py +++ b/tests/services/test_motioncorr_service.py @@ -197,14 +197,12 @@ def test_motioncor2_service_spa(mock_subprocess, offline_transport, tmp_path): mock_subprocess.assert_called_with(mc_command, capture_output=True) # Check symlinks - assert (tmp_path / "MotionCorr/Live_processing").is_symlink() - assert (tmp_path / "MotionCorr/Live_processing").readlink() == ( + assert (tmp_path / "MotionCorr/Live_motioncorr").is_symlink() + assert (tmp_path / "MotionCorr/Live_motioncorr").readlink() == ( tmp_path / "MotionCorr/job002" ) - assert (tmp_path / "Import/Live_processing").is_symlink() - assert (tmp_path / "Import/Live_processing").readlink() == ( - tmp_path / "Import/job001" - ) + assert (tmp_path / "Import/Live_import").is_symlink() + assert (tmp_path / "Import/Live_import").readlink() == (tmp_path / "Import/job001") # Check plotly file creation assert (tmp_path / "MotionCorr/job002/Movies/sample_drift_plot.json").is_file() @@ -294,7 +292,7 @@ def test_motioncor2_service_spa(mock_subprocess, offline_transport, tmp_path): "command": "", "stdout": "", "stderr": "", - "alias": "Live_processing", + "alias": "Live_import", }, ) offline_transport.send.assert_any_call( @@ -313,7 +311,7 @@ def test_motioncor2_service_spa(mock_subprocess, offline_transport, tmp_path): "early_motion": early_motion, "late_motion": late_motion, }, - "alias": "Live_processing", + "alias": "Live_motioncorr", }, ) @@ -554,7 +552,7 @@ def test_motioncor_relion_service_spa(mock_subprocess, offline_transport, tmp_pa "command": "", "stdout": "", "stderr": "", - "alias": "Live_processing", + "alias": "Live_import", }, ) offline_transport.send.assert_any_call( @@ -573,7 +571,7 @@ def test_motioncor_relion_service_spa(mock_subprocess, offline_transport, tmp_pa "early_motion": early_motion, "late_motion": late_motion, }, - "alias": "Live_processing", + "alias": "Live_motioncorr", }, ) @@ -754,7 +752,7 @@ def test_motioncor2_service_tomo(mock_subprocess, offline_transport, tmp_path): "command": "", "stdout": "", "stderr": "", - "alias": "Live_processing", + "alias": "Live_import", }, ) offline_transport.send.assert_any_call( @@ -773,7 +771,7 @@ def test_motioncor2_service_tomo(mock_subprocess, offline_transport, tmp_path): "early_motion": early_motion, "late_motion": late_motion, }, - "alias": "Live_processing", + "alias": "Live_motioncorr", }, ) @@ -969,7 +967,7 @@ def test_motioncor_relion_service_tomo(mock_subprocess, offline_transport, tmp_p "command": "", "stdout": "", "stderr": "", - "alias": "Live_processing", + "alias": "Live_import", }, ) offline_transport.send.assert_any_call( @@ -988,7 +986,7 @@ def test_motioncor_relion_service_tomo(mock_subprocess, offline_transport, tmp_p "early_motion": early_motion, "late_motion": late_motion, }, - "alias": "Live_processing", + "alias": "Live_motioncorr", }, ) @@ -1145,7 +1143,7 @@ def test_motioncor2_slurm_service_spa(mock_requests, offline_transport, tmp_path "early_motion": early_motion, "late_motion": late_motion, }, - "alias": "Live_processing", + "alias": "Live_motioncorr", }, ) @@ -1286,7 +1284,7 @@ def test_motioncor_superres_does_slurm(mock_requests, offline_transport, tmp_pat "command": " ".join(mc_command), "stdout": "cluster job submission", "stderr": "failed to submit job", - "alias": "Live_processing", + "alias": "Live_motioncorr", "success": False, }, ) @@ -1544,15 +1542,15 @@ def test_motioncor_check_symlink(mock_subprocess, offline_transport, tmp_path): # Case 2: ok symlink service.x_shift_list = [-3.0, 3.0] service.y_shift_list = [4.0, -4.0] - assert (tmp_path / "MotionCorr/Live_processing").is_symlink() + assert (tmp_path / "MotionCorr/Live_motioncorr").is_symlink() service.motion_correction(None, header=header, message=motioncorr_test_message) assert offline_transport.ack.call_count == 2 # Case 3: bad symlink service.x_shift_list = [-3.0, 3.0] service.y_shift_list = [4.0, -4.0] - (tmp_path / "MotionCorr/Live_processing").unlink() - (tmp_path / "MotionCorr/Live_processing").symlink_to(tmp_path / "Movies") + (tmp_path / "MotionCorr/Live_motioncorr").unlink() + (tmp_path / "MotionCorr/Live_motioncorr").symlink_to(tmp_path / "Movies") service.motion_correction(None, header=header, message=motioncorr_test_message) offline_transport.nack.assert_called_once() diff --git a/tests/services/test_topaz_pick.py b/tests/services/test_topaz_pick.py index b938cabf..9479e86d 100644 --- a/tests/services/test_topaz_pick.py +++ b/tests/services/test_topaz_pick.py @@ -85,8 +85,8 @@ def test_topaz_with_diameter( assert (written_coords["rlnAutopickFigureOfMerit"] == [1, 2, 3]).all() # Check symlinks - assert (tmp_path / "AutoPick/Live_processing").is_symlink() - assert (tmp_path / "AutoPick/Live_processing").readlink() == ( + assert (tmp_path / "AutoPick/Live_topaz_picking").is_symlink() + assert (tmp_path / "AutoPick/Live_topaz_picking").readlink() == ( tmp_path / "AutoPick/job007" ) @@ -145,7 +145,7 @@ def test_topaz_with_diameter( ), "stdout": "", "stderr": "", - "alias": "Live_processing", + "alias": "Live_topaz_picking", "success": True, }, ) @@ -305,13 +305,13 @@ def test_topaz_check_symlinks( offline_transport.ack.assert_called_once() # Case 2: ok symlink - assert (tmp_path / "AutoPick/Live_processing").is_symlink() + assert (tmp_path / "AutoPick/Live_topaz_picking").is_symlink() service.topaz(None, header=header, message=topaz_test_message) assert offline_transport.ack.call_count == 2 # Case 3: bad symlink - (tmp_path / "AutoPick/Live_processing").unlink() - (tmp_path / "AutoPick/Live_processing").symlink_to(tmp_path / "AutoPick") + (tmp_path / "AutoPick/Live_topaz_picking").unlink() + (tmp_path / "AutoPick/Live_topaz_picking").symlink_to(tmp_path / "AutoPick") service.topaz(None, header=header, message=topaz_test_message) offline_transport.nack.assert_called_once()