Skip to content

Commit 616ecaf

Browse files
committed
Merged recent changes from 'main' branch
2 parents b6b6b50 + 2c4df3b commit 616ecaf

34 files changed

+1401
-681
lines changed

.bumpclient.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.bumpversion]
2-
current_version = "0.15.1"
2+
current_version = "0.15.3"
33
commit = true
44
tag = false
55

.bumpversion.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.bumpversion]
2-
current_version = "0.15.1"
2+
current_version = "0.15.3"
33
commit = true
44
tag = true
55

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A transporter for data from Diamond eBIC microscope and detector machines onto the Diamond network.
44

5-
### Who is Murfey?
5+
## Who is Murfey?
66

77
Murfey, the package, is named after [Eliza Murfey, the inventor](https://nationalrrmuseum.org/blog/mother-of-invention-women-railroad-innovators/):
88

@@ -11,38 +11,38 @@ Murfey, the package, is named after [Eliza Murfey, the inventor](https://nationa
1111
> it was Murfey who designed the packings that would lubricate the axles with oil, aiding
1212
> in the reduction of derailments caused by seized axles and bearings.
1313
14-
### How do I set up a development environment?
14+
## How do I set up a development environment?
1515

1616
We suggest you start with your favourite virtual environment (mamba/conda/python virtualenv/...),
1717
then install using the following command.
1818

19-
#### From Git
20-
21-
```bash
19+
```text
2220
$ git clone [email protected]:DiamondLightSource/python-murfey.git
2321
$ cd python-murfey
2422
$ pip install -e .[client,server,developer]
2523
```
2624

2725
The packages included under the `[developer]` installation key contain some helpful tools to aid you with developing Murfey further:
2826

27+
- `bump-my-version` - Simplifies version control.
2928
- `ipykernel` - Enables interactive code development via Jupyter Notebooks.
3029
- `pre-commit` - Allows for the installation and running of hooks to help with linting, formatting, and type checking your code.
3130
- `pytest` - Used in conjunction with test functions to evaluate the reliability of your code.
32-
- `bump2version` - A nice little script to simplify version control.
31+
32+
Instructions for setting up the database for Murfey to register files to can be found [here](src/murfey/server/MURFEY_DB.md).
3333

3434
Finally, you may want to set up an ISPyB mock database server and a Zocalo
3535
development environment. The instructions for this are out of scope here.
3636

3737
You can then start the Murfey server with
3838

39-
```bash
39+
```text
4040
$ murfey.server
4141
```
4242

4343
and connect the client with
4444

45-
```bash
45+
```text
4646
$ murfey --server http://127.0.0.1:8000
4747
```
4848

pyproject.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires = [
77

88
[project]
99
name = "murfey"
10-
version = "0.15.1"
10+
version = "0.15.3"
1111
description = "Client-Server architecture hauling Cryo-EM data"
1212
readme = "README.md"
1313
keywords = [
@@ -30,6 +30,7 @@ classifiers = [
3030
"Programming Language :: Python :: 3.12",
3131
]
3232
dependencies = [
33+
"backports.entry_points_selectable",
3334
"defusedxml", # For safely parsing XML files
3435
"pydantic<2", # Locked to <2 by zocalo
3536
"requests",
@@ -55,7 +56,6 @@ developer = [
5556
server = [
5657
# "matplotlib", # For visual statistical analysis of images
5758
"aiohttp",
58-
"backports.entry_points_selectable",
5959
"cryptography",
6060
"fastapi[standard]",
6161
"ispyb", # Responsible for setting requirements for SQLAlchemy and mysql-connector-python; v10.0.0: sqlalchemy <2, mysql-connector-python >=8.0.32
@@ -96,9 +96,13 @@ murfey = "murfey.client:run"
9696
"murfey.transfer" = "murfey.cli.transfer:run"
9797
[project.entry-points."murfey.auth.token_validation"]
9898
"password" = "murfey.server.api.auth:password_token_validation"
99+
[project.entry-points."murfey.config.extraction"]
100+
"murfey_machine" = "murfey.util.config:get_extended_machine_config"
99101
[project.entry-points."murfey.workflows"]
100-
"lif_to_stack" = "murfey.workflows.lif_to_stack:zocalo_cluster_request"
101-
"tiff_to_stack" = "murfey.workflows.tiff_to_stack:zocalo_cluster_request"
102+
"process_raw_lifs" = "murfey.workflows.clem.process_raw_lifs:zocalo_cluster_request"
103+
"process_raw_tiffs" = "murfey.workflows.clem.process_raw_tiffs:zocalo_cluster_request"
104+
"register_lif_preprocessing_result" = "murfey.workflows.clem.register_preprocessing_results:register_lif_preprocessing_result"
105+
"register_tiff_preprocessing_result" = "murfey.workflows.clem.register_preprocessing_results:register_tiff_preprocessing_result"
102106

103107
[tool.setuptools]
104108
package-dir = {"" = "src"}

src/murfey/__init__.py

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

3-
__version__ = "0.15.1"
4-
__supported_client_version__ = "0.15.1"
3+
__version__ = "0.15.3"
4+
__supported_client_version__ = "0.15.3"

src/murfey/client/__init__.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,31 @@ def read_config() -> configparser.ConfigParser:
6565
requests.delete = partial(requests.delete, headers={"Authorization": f"Bearer {token}"})
6666

6767

68+
def write_config(config: configparser.ConfigParser):
69+
mcch = os.environ.get("MURFEY_CLIENT_CONFIG_HOME")
70+
murfey_client_config_home = Path(mcch) if mcch else Path.home()
71+
with open(murfey_client_config_home / ".murfey", "w") as configfile:
72+
config.write(configfile)
73+
74+
75+
def main_loop(
76+
source_watchers: List[murfey.client.watchdir.DirWatcher],
77+
appearance_time: float,
78+
transfer_all: bool,
79+
):
80+
log.info(
81+
f"Murfey {murfey.__version__} on Python {'.'.join(map(str, sys.version_info[0:3]))} entering main loop"
82+
)
83+
if appearance_time > 0:
84+
modification_time: float | None = time.time() - appearance_time * 3600
85+
else:
86+
modification_time = None
87+
while True:
88+
for sw in source_watchers:
89+
sw.scan(modification_time=modification_time, transfer_all=transfer_all)
90+
time.sleep(15)
91+
92+
6893
def _enable_webbrowser_in_cygwin():
6994
"""Helper function to make webbrowser.open() work in CygWin"""
7095
if "cygwin" in platform.system().lower() and shutil.which("cygstart"):
@@ -288,7 +313,9 @@ def run():
288313

289314
status_bar = StatusBar()
290315

291-
machine_data = requests.get(f"{murfey_url.geturl()}/machine").json()
316+
machine_data = requests.get(
317+
f"{murfey_url.geturl()}/instruments/{instrument_name}/machine"
318+
).json()
292319
gain_ref: Path | None = None
293320

294321
instance_environment = MurfeyInstanceEnvironment(
@@ -323,28 +350,3 @@ def run():
323350
)
324351
app.run()
325352
rich_handler.redirect = False
326-
327-
328-
def main_loop(
329-
source_watchers: List[murfey.client.watchdir.DirWatcher],
330-
appearance_time: float,
331-
transfer_all: bool,
332-
):
333-
log.info(
334-
f"Murfey {murfey.__version__} on Python {'.'.join(map(str, sys.version_info[0:3]))} entering main loop"
335-
)
336-
if appearance_time > 0:
337-
modification_time: float | None = time.time() - appearance_time * 3600
338-
else:
339-
modification_time = None
340-
while True:
341-
for sw in source_watchers:
342-
sw.scan(modification_time=modification_time, transfer_all=transfer_all)
343-
time.sleep(15)
344-
345-
346-
def write_config(config: configparser.ConfigParser):
347-
mcch = os.environ.get("MURFEY_CLIENT_CONFIG_HOME")
348-
murfey_client_config_home = Path(mcch) if mcch else Path.home()
349-
with open(murfey_client_config_home / ".murfey", "w") as configfile:
350-
config.write(configfile)

src/murfey/client/context.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pathlib import Path
55
from typing import Any, Dict, List, NamedTuple
66

7-
import importlib_metadata
7+
from backports.entry_points_selectable import entry_points
88

99
from murfey.client.instance_environment import MurfeyInstanceEnvironment
1010

@@ -41,7 +41,8 @@ def __init__(self, name: str, acquisition_software: str):
4141
self.name = name
4242

4343
def post_transfer(self, transferred_file: Path, role: str = "", **kwargs):
44-
for h in importlib_metadata.entry_points(group="murfey.post_transfer_hooks"):
44+
# Search external packages for additional hooks to include in Murfey
45+
for h in entry_points(group="murfey.post_transfer_hooks"):
4546
if h.name == self.name:
4647
h.load()(transferred_file, role=role, **kwargs)
4748

src/murfey/client/contexts/clem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def process_lif_file(
386386

387387
try:
388388
# Construct the URL to post the request to
389-
url = f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/lif_to_stack?lif_file={quote(str(lif_file), safe='')}"
389+
url = f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/clem/preprocessing/process_raw_lifs?lif_file={quote(str(lif_file), safe='')}"
390390
# Validate
391391
if not url:
392392
logger.error(
@@ -442,7 +442,7 @@ def process_tiff_series(
442442

443443
try:
444444
# Construct URL for Murfey server to communicate with
445-
url = f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/tiff_to_stack"
445+
url = f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/clem/preprocessing/process_raw_tiffs"
446446
if not url:
447447
logger.error(
448448
"URL could not be constructed from the environment and file path"

0 commit comments

Comments
 (0)