Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/cryoemservices/services/cryolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/cryoemservices/services/ctffind.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/cryoemservices/services/extract_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
14 changes: 7 additions & 7 deletions src/cryoemservices/services/motioncorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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 = {
Expand All @@ -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)

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/cryoemservices/services/topaz_pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)
Expand Down Expand Up @@ -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:
Expand Down
14 changes: 7 additions & 7 deletions tests/services/test_cryolo_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
},
)
Expand Down Expand Up @@ -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,
},
)
Expand Down Expand Up @@ -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()

Expand Down
16 changes: 8 additions & 8 deletions tests/services/test_ctffind_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
},
)
Expand Down Expand Up @@ -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,
},
)
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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,
},
)
Expand Down
2 changes: 1 addition & 1 deletion tests/services/test_extract_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 17 additions & 19 deletions tests/services/test_motioncorr_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(
Expand All @@ -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",
},
)

Expand Down Expand Up @@ -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(
Expand All @@ -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",
},
)

Expand Down Expand Up @@ -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(
Expand All @@ -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",
},
)

Expand Down Expand Up @@ -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(
Expand All @@ -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",
},
)

Expand Down Expand Up @@ -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",
},
)

Expand Down Expand Up @@ -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,
},
)
Expand Down Expand Up @@ -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()

Expand Down
12 changes: 6 additions & 6 deletions tests/services/test_topaz_pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -145,7 +145,7 @@ def test_topaz_with_diameter(
),
"stdout": "",
"stderr": "",
"alias": "Live_processing",
"alias": "Live_topaz_picking",
"success": True,
},
)
Expand Down Expand Up @@ -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()

Expand Down
Loading