Skip to content

Commit c987788

Browse files
committed
Remove updates of global state
1 parent 7cffb19 commit c987788

File tree

4 files changed

+1
-104
lines changed

4 files changed

+1
-104
lines changed

src/murfey/server/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
get_security_config,
5858
)
5959
from murfey.util.processing_params import default_spa_parameters
60-
from murfey.util.state import global_state
6160
from murfey.util.tomo import midpoint
6261

6362
try:
@@ -2258,17 +2257,6 @@ def feedback_callback(header: dict, message: dict) -> None:
22582257
time.sleep(2)
22592258
_transport_object.transport.nack(header, requeue=True)
22602259
return None
2261-
if global_state.get("data_collection_group_ids") and isinstance(
2262-
global_state["data_collection_group_ids"], dict
2263-
):
2264-
global_state["data_collection_group_ids"] = {
2265-
**global_state["data_collection_group_ids"],
2266-
message.get("tag"): dcgid,
2267-
}
2268-
else:
2269-
global_state["data_collection_group_ids"] = {
2270-
message.get("tag"): dcgid
2271-
}
22722260
_transport_object.transport.ack(header)
22732261
if dcg_hooks := entry_points().select(
22742262
group="murfey.hooks", name="data_collection_group"

src/murfey/server/api/__init__.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
BLSampleImageParameters,
7777
BLSampleParameters,
7878
BLSubSampleParameters,
79-
ClearanceKeys,
8079
ClientInfo,
8180
ContextInfo,
8281
CurrentGainRef,
@@ -107,7 +106,6 @@
107106
Visit,
108107
)
109108
from murfey.util.processing_params import default_spa_parameters
110-
from murfey.util.state import global_state
111109
from murfey.util.tomo import midpoint
112110
from murfey.workflows.spa.flush_spa_preprocess import (
113111
register_foil_hole,
@@ -1795,42 +1793,6 @@ async def make_gif(
17951793
return {"output_gif": str(output_path)}
17961794

17971795

1798-
@router.post("/visits/{visit_name}/clean_state")
1799-
async def clean_state(visit_name: str, for_clearance: ClearanceKeys):
1800-
if global_state.get("data_collection_group_ids") and isinstance(
1801-
global_state["data_collection_group_ids"], dict
1802-
):
1803-
global_state["data_collection_group_ids"] = {
1804-
k: v
1805-
for k, v in global_state["data_collection_group_ids"].items()
1806-
if k not in for_clearance.data_collection_group
1807-
}
1808-
if global_state.get("data_collection_ids") and isinstance(
1809-
global_state["data_collection_ids"], dict
1810-
):
1811-
global_state["data_collection_ids"] = {
1812-
k: v
1813-
for k, v in global_state["data_collection_ids"].items()
1814-
if k not in for_clearance.data_collection
1815-
}
1816-
if global_state.get("processing_job_ids") and isinstance(
1817-
global_state["processing_job_ids"], dict
1818-
):
1819-
global_state["processing_job_ids"] = {
1820-
k: v
1821-
for k, v in global_state["processing_job_ids"].items()
1822-
if k not in for_clearance.processing_job
1823-
}
1824-
if global_state.get("autoproc_program_ids") and isinstance(
1825-
global_state["autoproc_program_ids"], dict
1826-
):
1827-
global_state["autoproc_program_ids"] = {
1828-
k: v
1829-
for k, v in global_state["autoproc_program_ids"].items()
1830-
if k not in for_clearance.autoproc_program
1831-
}
1832-
1833-
18341796
@router.get("/new_client_id/")
18351797
async def new_client_id(db=murfey_db):
18361798
clients = db.exec(select(ClientEnvironment)).all()

src/murfey/server/demo_api.py

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
Visit,
9090
)
9191
from murfey.util.processing_params import default_spa_parameters
92-
from murfey.util.state import global_state
9392
from murfey.workflows.spa.picking import _register_picked_particles_use_diameter
9493

9594
log = logging.getLogger("murfey.server.demo_api")
@@ -1447,15 +1446,6 @@ def register_dc_group(
14471446
db.add(murfey_app_3d)
14481447
db.commit()
14491448

1450-
if global_state.get("data_collection_group_ids") and isinstance(
1451-
global_state["data_collection_group_ids"], dict
1452-
):
1453-
global_state["data_collection_group_ids"] = {
1454-
**global_state["data_collection_group_ids"],
1455-
dcg_params.tag: dcgid,
1456-
}
1457-
else:
1458-
global_state["data_collection_group_ids"] = {dcg_params.tag: dcgid}
14591449
if dcg_params.atlas:
14601450
_flush_grid_square_records(
14611451
{"session_id": session_id, "tag": dcg_params.tag}, demo=True
@@ -1511,15 +1501,6 @@ def start_dc(
15111501
db.add(murfey_app)
15121502
db.commit()
15131503
db.close()
1514-
if global_state.get("data_collection_ids") and isinstance(
1515-
global_state["data_collection_ids"], dict
1516-
):
1517-
global_state["data_collection_ids"] = {
1518-
**global_state["data_collection_ids"],
1519-
dc_params.tag: 1,
1520-
}
1521-
else:
1522-
global_state["data_collection_ids"] = {dc_params.tag: 1}
15231504
if dc_params.exposure_time:
15241505
prom.exposure_time.set(dc_params.exposure_time)
15251506
return dc_params
@@ -1529,35 +1510,8 @@ def start_dc(
15291510
def register_proc(
15301511
visit_name, session_id: MurfeySessionID, proc_params: ProcessingJobParameters
15311512
):
1513+
# This should probably do something
15321514
log.info("Registering processing job")
1533-
if global_state.get("processing_job_ids"):
1534-
assert isinstance(global_state["processing_job_ids"], dict)
1535-
global_state["processing_job_ids"] = {
1536-
**{
1537-
k: v
1538-
for k, v in global_state["processing_job_ids"].items()
1539-
if k != proc_params.tag
1540-
},
1541-
proc_params.tag: {
1542-
**global_state["processing_job_ids"].get(proc_params.tag, {}),
1543-
proc_params.recipe: 1,
1544-
},
1545-
}
1546-
else:
1547-
global_state["processing_job_ids"] = {proc_params.tag: {proc_params.recipe: 1}}
1548-
if global_state.get("autoproc_program_ids"):
1549-
assert isinstance(global_state["autoproc_program_ids"], dict)
1550-
global_state["autoproc_program_ids"] = {
1551-
**global_state["autoproc_program_ids"],
1552-
proc_params.tag: {
1553-
**global_state["autoproc_program_ids"].get(proc_params.tag, {}),
1554-
proc_params.recipe: 1,
1555-
},
1556-
}
1557-
else:
1558-
global_state["autoproc_program_ids"] = {
1559-
proc_params.tag: {proc_params.recipe: 1}
1560-
}
15611515
log.info("Processing job registered")
15621516
return proc_params
15631517

src/murfey/util/models.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,6 @@ class RsyncerInfo(BaseModel):
127127
tag: str = ""
128128

129129

130-
class ClearanceKeys(BaseModel):
131-
data_collection_group: List[str]
132-
data_collection: List[str]
133-
processing_job: List[str]
134-
autoproc_program: List[str]
135-
136-
137130
class GainReference(BaseModel):
138131
gain_ref: Path
139132
rescale: bool = True

0 commit comments

Comments
 (0)