Skip to content

Commit b549e56

Browse files
committed
Move sxt processing to workflow
1 parent b2826e5 commit b549e56

4 files changed

Lines changed: 33 additions & 12 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ TomographyMetadataContext = "murfey.client.contexts.tomo_metadata:TomographyMeta
125125
"spa.ctf_estimated" = "murfey.workflows.spa.ctf_estimation:ctf_estimated"
126126
"spa.flush_spa_preprocess" = "murfey.workflows.spa.flush_spa_preprocess:flush_spa_preprocess"
127127
"spa.motion_corrected" = "murfey.workflows.spa.motion_correction:motion_corrected"
128+
"sxt.process_tilt_series" = "murfey.workflows.sxt.process_sxt_tilt_series:process_sxt_tilt_series"
128129

129130
[tool.setuptools]
130131
package-dir = {"" = "src"}

src/murfey/client/contexts/sxt.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@ def register_sxt_data_collection(
125125
data=dc_data,
126126
)
127127

128-
recipes_to_assign_pjids = [
129-
"sxt-aretomo",
130-
"sxt-imod-patch",
131-
]
128+
recipes_to_assign_pjids = self._machine_config.get("recipes", {}).values()
132129
for recipe in recipes_to_assign_pjids:
133130
capture_post(
134131
base_url=str(environment.url.geturl()),

src/murfey/server/api/workflow.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
from murfey.util.tomo import midpoint
8181
from murfey.workflows.sxt.process_sxt_tilt_series import (
8282
SXTTiltSeriesInfo,
83-
process_sxt_tilt_series_workflow,
8483
)
8584
from murfey.workflows.tomo.tomo_metadata import register_search_map_in_database
8685

@@ -1086,9 +1085,16 @@ def process_sxt_tilt_series(
10861085
tilt_series_info: SXTTiltSeriesInfo,
10871086
db=murfey_db,
10881087
):
1089-
return process_sxt_tilt_series_workflow(
1090-
visit_name, session_id, tilt_series_info, db
1091-
)
1088+
if _transport_object:
1089+
_transport_object.send(
1090+
_transport_object.feedback_queue,
1091+
{
1092+
"register": "sxt.process_tilt_series",
1093+
"session_id": session_id,
1094+
"visit_name": visit_name,
1095+
"tilt_series_info": tilt_series_info.model_dump(mode="json"),
1096+
},
1097+
)
10921098

10931099

10941100
correlative_router = APIRouter(

src/murfey/workflows/sxt/process_sxt_tilt_series.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ class SXTTiltSeriesInfo(BaseModel):
3131
xrm_reference: str | None
3232

3333

34-
def process_sxt_tilt_series_workflow(
34+
def process_sxt_tilt_series(
3535
visit_name: str,
3636
session_id: MurfeySessionID,
3737
tilt_series_info: SXTTiltSeriesInfo,
3838
murfey_db: Session,
39-
):
39+
) -> dict[str, bool]:
4040
tilt_series_query = murfey_db.exec(
4141
select(TiltSeries)
4242
.where(TiltSeries.session_id == session_id)
@@ -47,7 +47,7 @@ def process_sxt_tilt_series_workflow(
4747
tilt_series = tilt_series_query[0]
4848
if tilt_series.processing_requested:
4949
logger.info(f"Tilt series {tilt_series.tag} has already been processed")
50-
return
50+
return {"success": True}
5151
else:
5252
tilt_series = TiltSeries(
5353
session_id=session_id,
@@ -69,6 +69,10 @@ def process_sxt_tilt_series_workflow(
6969
.where(ProcessingJob.dc_id == DataCollection.id)
7070
.where(AutoProcProgram.pj_id == ProcessingJob.id)
7171
).all()
72+
if len(collected_ids) == 0:
73+
logger.warning(f"No processing recipes found for {tilt_series.tag}")
74+
return {"success": False, "requeue": False}
75+
7276
instrument_name = (
7377
murfey_db.exec(select(Session).where(Session.id == session_id))
7478
.one()
@@ -96,8 +100,20 @@ def process_sxt_tilt_series_workflow(
96100
)
97101
stack_file.parent.mkdir(parents=True, exist_ok=True)
98102

103+
# Loop over all processing jobs, and send the alignment recipe for it
99104
for recipe_ids in collected_ids:
100-
# Loop over all processing jobs, and send the alignment recipe for it
105+
# Stack file path needs to contain both recipe name and tilt series anem
106+
stack_file = (
107+
core
108+
/ machine_config.processed_directory_name
109+
/ tilt_series.tag
110+
/ recipe_ids[2].recipe
111+
/ "Tomograms"
112+
/ f"{tilt_series.tag}_stack.mrc"
113+
)
114+
stack_file.parent.mkdir(parents=True, exist_ok=True)
115+
116+
# Send message to rabbitmq
101117
zocalo_message = {
102118
"recipes": recipe_ids[2].recipe,
103119
"parameters": {
@@ -126,3 +142,4 @@ def process_sxt_tilt_series_workflow(
126142
tilt_series.processing_requested = True
127143
murfey_db.add(tilt_series)
128144
murfey_db.commit()
145+
return {"success": True}

0 commit comments

Comments
 (0)