Skip to content

Commit 2cdadea

Browse files
committed
message send change and atlas id fixes
1 parent cfe50ba commit 2cdadea

File tree

2 files changed

+36
-24
lines changed

2 files changed

+36
-24
lines changed

src/murfey/server/__init__.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,19 +2470,16 @@ def _save_bfactor(message: dict, _db=murfey_db, demo: bool = False):
24702470
_transport_object.send(
24712471
"ispyb_connector",
24722472
{
2473-
"parameters": {
2474-
"ispyb_command": "buffer",
2475-
"buffer_lookup": {
2476-
"particle_classification_id": refined_class_uuid,
2477-
},
2478-
"buffer_command": {
2479-
"ispyb_command": "insert_particle_classification"
2480-
},
2481-
"program_id": message["program_id"],
2482-
"bfactor_fit_intercept": str(bfactor_fitting[1]),
2483-
"bfactor_fit_linear": str(bfactor_fitting[0]),
2473+
"ispyb_command": "buffer",
2474+
"buffer_lookup": {
2475+
"particle_classification_id": refined_class_uuid,
2476+
},
2477+
"buffer_command": {
2478+
"ispyb_command": "insert_particle_classification"
24842479
},
2485-
"content": {"dummy": "dummy"},
2480+
"program_id": message["program_id"],
2481+
"bfactor_fit_intercept": str(bfactor_fitting[1]),
2482+
"bfactor_fit_linear": str(bfactor_fitting[0]),
24862483
},
24872484
new_connection=True,
24882485
)
@@ -2638,7 +2635,9 @@ def feedback_callback(header: dict, message: dict) -> None:
26382635
cassetteSlot=message.get("sample"),
26392636
)
26402637
if _transport_object:
2641-
atlas_id = _transport_object.do_insert_atlas(atlas_record)
2638+
atlas_id = _transport_object.do_insert_atlas(atlas_record)[
2639+
"return_value"
2640+
]
26422641
murfey_dcg = db.DataCollectionGroup(
26432642
id=dcgid,
26442643
atlas_id=atlas_id,

src/murfey/server/api/__init__.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import sqlalchemy
1212
from fastapi import APIRouter, Depends, Request
1313
from fastapi.responses import FileResponse, HTMLResponse
14+
from ispyb.sqlalchemy import Atlas
1415
from ispyb.sqlalchemy import AutoProcProgram as ISPyBAutoProcProgram
1516
from ispyb.sqlalchemy import (
1617
BLSample,
@@ -1431,19 +1432,31 @@ def register_dc_group(
14311432
dcg_murfey[0].atlas = dcg_params.atlas
14321433
dcg_murfey[0].sample = dcg_params.sample
14331434
dcg_murfey[0].atlas_pixel_size = dcg_params.atlas_pixel_size
1435+
1436+
if _transport_object:
1437+
if dcg_murfey[0].atlas_id is not None:
1438+
_transport_object.send(
1439+
_transport_object.feedback_queue,
1440+
{
1441+
"register": "atlas_update",
1442+
"atlas_id": dcg_murfey[0].atlas_id,
1443+
"atlas": dcg_params.atlas,
1444+
"sample": dcg_params.sample,
1445+
"atlas_pixel_size": dcg_params.atlas_pixel_size,
1446+
},
1447+
)
1448+
else:
1449+
atlas_id_response = _transport_object.do_insert_atlas(
1450+
Atlas(
1451+
dataCollectionGroupId=dcg_murfey[0].id,
1452+
atlasImage=dcg_params.atlas,
1453+
pixelSize=dcg_params.atlas_pixel_size,
1454+
cassetteSlot=dcg_params.sample,
1455+
)
1456+
)
1457+
dcg_murfey[0].atlas_id = atlas_id_response["return_value"]
14341458
db.add(dcg_murfey[0])
14351459
db.commit()
1436-
if _transport_object:
1437-
_transport_object.send(
1438-
_transport_object.feedback_queue,
1439-
{
1440-
"register": "atlas_update",
1441-
"atlas_id": dcg_murfey.atlas_id,
1442-
"atlas": dcg_params.atlas,
1443-
"sample": dcg_params.sample,
1444-
"atlas_pixel_size": dcg_params.atlas_pixel_size,
1445-
},
1446-
)
14471460
else:
14481461
dcg_parameters = {
14491462
"start_time": str(datetime.datetime.now()),

0 commit comments

Comments
 (0)