Skip to content

Commit 68e1f94

Browse files
Post to data collection group hooks when the atlas is updated (#609)
For the Scaup sample tracking to work we need to update the data collection group hooks when we post new atlas information
1 parent 51bd421 commit 68e1f94

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/murfey/server/api/workflow.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ def register_dc_group(
100100
.where(DataCollectionGroup.session_id == session_id)
101101
.where(DataCollectionGroup.tag == dcg_params.tag)
102102
).all():
103-
dcg_murfey[0].atlas = dcg_params.atlas
104-
dcg_murfey[0].sample = dcg_params.sample
105-
dcg_murfey[0].atlas_pixel_size = dcg_params.atlas_pixel_size
103+
dcg_murfey[0].atlas = dcg_params.atlas or dcg_murfey[0].atlas
104+
dcg_murfey[0].sample = dcg_params.sample or dcg_murfey[0].sample
105+
dcg_murfey[0].atlas_pixel_size = (
106+
dcg_params.atlas_pixel_size or dcg_murfey[0].atlas_pixel_size
107+
)
106108

107109
if _transport_object:
108110
if dcg_murfey[0].atlas_id is not None:
@@ -114,6 +116,8 @@ def register_dc_group(
114116
"atlas": dcg_params.atlas,
115117
"sample": dcg_params.sample,
116118
"atlas_pixel_size": dcg_params.atlas_pixel_size,
119+
"dcgid": dcg_murfey[0].id,
120+
"session_id": session_id,
117121
},
118122
)
119123
else:

src/murfey/server/feedback.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,16 @@ def feedback_callback(header: dict, message: dict) -> None:
20322032
message["sample"],
20332033
)
20342034
murfey.server._transport_object.transport.ack(header)
2035+
if dcg_hooks := entry_points().select(
2036+
group="murfey.hooks", name="data_collection_group"
2037+
):
2038+
try:
2039+
for hook in dcg_hooks:
2040+
hook.load()(message["dcgid"], session_id=message["session_id"])
2041+
except Exception:
2042+
logger.error(
2043+
"Call to data collection group hook failed", exc_info=True
2044+
)
20352045
return None
20362046
elif message["register"] == "data_collection":
20372047
logger.debug(

0 commit comments

Comments
 (0)