Skip to content

Commit

Permalink
speed up CLI and pin docker dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Aug 1, 2024
1 parent de73e5b commit de035b8
Show file tree
Hide file tree
Showing 4 changed files with 624 additions and 9 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10.9-bullseye
FROM python:3.11.9-slim-bullseye@sha256:8850f5e6e8da9081a6d156252a11161aa22f04d6ed1723c57ca2d5a5d48132bc

ARG DEBIAN_FRONTEND="noninteractive"

Expand All @@ -12,11 +12,12 @@ WORKDIR /home/neuro/bidsMReye

COPY [".", "/home/neuro/bidsMReye"]
RUN pip install --upgrade pip && \
pip3 install -e .
pip3 install -r requirements.txt && \
pip3 install .

RUN bidsmreye_model

ENTRYPOINT [ "//home/neuro/bidsMReye/entrypoint.sh" ]
ENTRYPOINT [ "/home/neuro/bidsMReye/entrypoint.sh" ]
COPY ["./docker/entrypoint.sh", \
"//home/neuro/bidsMReye/entrypoint.sh"]
"/home/neuro/bidsMReye/entrypoint.sh"]
RUN chmod +x /home/neuro/bidsMReye/entrypoint.sh
18 changes: 13 additions & 5 deletions bidsmreye/bidsmreye.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@
default_model,
log_levels,
)
from bidsmreye.download import download
from bidsmreye.generalize import generalize
from bidsmreye.logging import bidsmreye_log
from bidsmreye.prepare_data import prepare_data
from bidsmreye.quality_control import quality_control_input
from bidsmreye.visualize import group_report

log = bidsmreye_log(name="bidsmreye")

Expand Down Expand Up @@ -122,6 +117,8 @@ def bidsmreye(
log.debug(f"Configuration:\n{cfg}")

if action in {"all", "generalize"} and isinstance(cfg.model_weights_file, str):
from bidsmreye.download import download

Check warning on line 120 in bidsmreye/bidsmreye.py

View check run for this annotation

Codecov / codecov/patch

bidsmreye/bidsmreye.py#L120

Added line #L120 was not covered by tests

cfg.model_weights_file = download(cfg.model_weights_file)

dispatch(analysis_level=analysis_level, action=action, cfg=cfg)
Expand All @@ -130,20 +127,31 @@ def bidsmreye(
def dispatch(analysis_level: str, action: str, cfg: Config) -> None:
if analysis_level == "group":
if action == "qc":
from bidsmreye.visualize import group_report

group_report(cfg=cfg)
else:
log.error("Unknown group level action")
sys.exit(1)

elif analysis_level == "participant":
if action == "all":
from bidsmreye.generalize import generalize
from bidsmreye.prepare_data import prepare_data

Check warning on line 140 in bidsmreye/bidsmreye.py

View check run for this annotation

Codecov / codecov/patch

bidsmreye/bidsmreye.py#L139-L140

Added lines #L139 - L140 were not covered by tests

prepare_data(cfg)
generalize(cfg)
elif action == "prepare":
from bidsmreye.prepare_data import prepare_data

Check warning on line 145 in bidsmreye/bidsmreye.py

View check run for this annotation

Codecov / codecov/patch

bidsmreye/bidsmreye.py#L145

Added line #L145 was not covered by tests

prepare_data(cfg)
elif action == "generalize":
from bidsmreye.generalize import generalize

Check warning on line 149 in bidsmreye/bidsmreye.py

View check run for this annotation

Codecov / codecov/patch

bidsmreye/bidsmreye.py#L149

Added line #L149 was not covered by tests

generalize(cfg)
elif action == "qc":
from bidsmreye.quality_control import quality_control_input

Check warning on line 153 in bidsmreye/bidsmreye.py

View check run for this annotation

Codecov / codecov/patch

bidsmreye/bidsmreye.py#L153

Added line #L153 was not covered by tests

quality_control_input(cfg)
else:
log.error("Unknown participant level action")
Expand Down
Loading

0 comments on commit de035b8

Please sign in to comment.