Skip to content

Commit f91762e

Browse files
authored
Refactor feedback-callback and update package dependencies (#688)
* Migrated the following feedback-callback logic blocks into individual modules, and added unit tests: * 'atlas_update' * 'data_collection' * 'data_collection_group' * 'processing_job' * Modified `feedback_callback` entry points to return dictionary instead of boolean * Updated project package dependencies** * Removed the version lock on `stomp-py` from when `8.1.1` caused us issues * Removed the FastAPI version lock from when there were conflicting `httpx` version dependencies * Added `graypy` as an explicit package dependency, since we use it directly * Removed `backports.entry_points_selectable` now that Python 3.9 has been dropped
1 parent 443fec9 commit f91762e

23 files changed

+784
-380
lines changed

pyproject.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ classifiers = [
2929
"Programming Language :: Python :: 3.12",
3030
]
3131
dependencies = [
32-
"backports.entry_points_selectable",
3332
"defusedxml", # For safely parsing XML files
3433
"pydantic>=2",
3534
"pydantic-settings",
@@ -55,13 +54,14 @@ developer = [
5554
]
5655
instrument-server = [
5756
"aiohttp",
58-
"fastapi[standard]<0.116.0",
57+
"fastapi[standard-no-fastapi-cloud-cli]>=0.116.0",
5958
"python-jose",
6059
]
6160
server = [
6261
"aiohttp",
6362
"cryptography",
64-
"fastapi[standard]<0.116.0",
63+
"fastapi[standard-no-fastapi-cloud-cli]>=0.116.0",
64+
"graypy",
6565
"ispyb>=10.2.4", # Responsible for setting requirements for SQLAlchemy and mysql-connector-python;
6666
"jinja2",
6767
"mrcfile",
@@ -73,7 +73,7 @@ server = [
7373
"python-jose[cryptography]",
7474
"sqlalchemy[postgresql]", # Add as explicit dependency
7575
"sqlmodel",
76-
"stomp-py<=8.1.0", # 8.1.1 (released 2024-04-06) doesn't work with our project
76+
"stomp-py>8.1.1", # 8.1.1 (released 2024-04-06) doesn't work with our project
7777
"zocalo>=1",
7878
]
7979
[project.urls]
@@ -100,14 +100,18 @@ GitHub = "https://github.com/DiamondLightSource/python-murfey"
100100
[project.entry-points."murfey.config.extraction"]
101101
"murfey_machine" = "murfey.util.config:get_extended_machine_config"
102102
[project.entry-points."murfey.workflows"]
103+
"atlas_update" = "murfey.workflows.register_atlas_update:run"
103104
"clem.align_and_merge" = "murfey.workflows.clem.align_and_merge:submit_cluster_request"
104105
"clem.process_raw_lifs" = "murfey.workflows.clem.process_raw_lifs:zocalo_cluster_request"
105106
"clem.process_raw_tiffs" = "murfey.workflows.clem.process_raw_tiffs:zocalo_cluster_request"
106107
"clem.register_align_and_merge_result" = "murfey.workflows.clem.register_align_and_merge_results:register_align_and_merge_result"
107108
"clem.register_preprocessing_result" = "murfey.workflows.clem.register_preprocessing_results:run"
109+
"data_collection" = "murfey.workflows.register_data_collection:run"
110+
"data_collection_group" = "murfey.workflows.register_data_collection_group:run"
108111
"pato" = "murfey.workflows.notifications:notification_setup"
109112
"picked_particles" = "murfey.workflows.spa.picking:particles_picked"
110113
"picked_tomogram" = "murfey.workflows.tomo.picking:picked_tomogram"
114+
"processing_job" = "murfey.workflows.register_processing_job:run"
111115
"spa.flush_spa_preprocess" = "murfey.workflows.spa.flush_spa_preprocess:flush_spa_preprocess"
112116

113117
[tool.setuptools]

src/murfey/client/context.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from __future__ import annotations
22

33
import logging
4+
from importlib.metadata import entry_points
45
from pathlib import Path
56
from typing import Any, Dict, List, NamedTuple
67

7-
from backports.entry_points_selectable import entry_points
8-
98
from murfey.client.instance_environment import MurfeyInstanceEnvironment
109

1110
logger = logging.getLogger("murfey.client.context")

src/murfey/server/api/clem.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
import re
44
import traceback
55
from ast import literal_eval
6-
from importlib.metadata import EntryPoint # type hinting only
6+
from importlib.metadata import (
7+
EntryPoint, # type hinting only
8+
entry_points,
9+
)
710
from logging import getLogger
811
from pathlib import Path
912
from typing import Literal, Optional, Type, Union
1013

11-
from backports.entry_points_selectable import entry_points
1214
from fastapi import APIRouter
1315
from pydantic import BaseModel, field_validator
1416
from sqlalchemy.exc import NoResultFound
@@ -752,9 +754,7 @@ def process_raw_lifs(
752754
try:
753755
# Try and load relevant Murfey workflow
754756
workflow: EntryPoint = list(
755-
entry_points().select(
756-
group="murfey.workflows", name="clem.process_raw_lifs"
757-
)
757+
entry_points(group="murfey.workflows", name="clem.process_raw_lifs")
758758
)[0]
759759
except IndexError:
760760
raise RuntimeError("The relevant Murfey workflow was not found")
@@ -792,9 +792,7 @@ def process_raw_tiffs(
792792
try:
793793
# Try and load relevant Murfey workflow
794794
workflow: EntryPoint = list(
795-
entry_points().select(
796-
group="murfey.workflows", name="clem.process_raw_tiffs"
797-
)
795+
entry_points(group="murfey.workflows", name="clem.process_raw_tiffs")
798796
)[0]
799797
except IndexError:
800798
raise RuntimeError("The relevant Murfey workflow was not found")
@@ -853,7 +851,7 @@ def align_and_merge_stacks(
853851
try:
854852
# Try and load relevant Murfey workflow
855853
workflow: EntryPoint = list(
856-
entry_points().select(group="murfey.workflows", name="clem.align_and_merge")
854+
entry_points(group="murfey.workflows", name="clem.align_and_merge")
857855
)[0]
858856
except IndexError:
859857
raise RuntimeError("The relevant Murfey workflow was not found")

0 commit comments

Comments
 (0)