Skip to content

Commit 532322d

Browse files
authored
Merge pull request #2 from FCP-INDI/engine/(th)re(e)sources
♻️ Split `ResourcePool` into three classes
2 parents 384f1e7 + 0a53108 commit 532322d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4080
-3948
lines changed

.circleci/main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ commands:
6868
steps:
6969
- run:
7070
name: Getting Sample BIDS Data
71-
command: git clone https://github.com/bids-standard/bids-examples.git
71+
command: |
72+
mkdir -p /home/circleci/project/dev/circleci_data/.pytest_cache/d/bids-examples
73+
git clone https://github.com/bids-standard/bids-examples.git /home/circleci/project/dev/circleci_data/.pytest_cache/d/bids-examples
7274
get-singularity:
7375
parameters:
7476
version:
@@ -156,7 +158,7 @@ commands:
156158
then
157159
TAG=nightly
158160
else
159-
TAG="${CIRCLE_BRANCH//\//_}"
161+
TAG=`echo ${CIRCLE_BRANCH} | sed 's/[^a-zA-Z0-9._]/-/g'`
160162
fi
161163
DOCKER_TAG="ghcr.io/${CIRCLE_PROJECT_USERNAME,,}/${CIRCLE_PROJECT_REPONAME,,}:${TAG,,}"
162164
if [[ -n "<< parameters.variant >>" ]]
@@ -172,7 +174,7 @@ commands:
172174
name: Testing Singularity installation
173175
command: |
174176
pip install -r dev/circleci_data/requirements.txt
175-
coverage run -m pytest --junitxml=test-results/junit.xml --continue-on-collection-errors dev/circleci_data/test_install.py
177+
coverage run -m pytest --capture=no --junitxml=test-results/junit.xml --continue-on-collection-errors dev/circleci_data/test_install.py
176178
177179
jobs:
178180
combine-coverage:

.github/workflows/build_C-PAC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
GITHUB_BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-)
4343
if [[ ! $GITHUB_BRANCH == 'main' ]] && [[ ! $GITHUB_BRANCH == 'develop' ]]
4444
then
45-
TAG=${GITHUB_BRANCH//\//_}
45+
TAG=`echo ${GITHUB_BRANCH} | sed 's/[^a-zA-Z0-9._]/-/g'`
4646
DOCKERFILE=.github/Dockerfiles/C-PAC.develop$VARIANT-$OS.Dockerfile
4747
elif [[ $GITHUB_BRANCH == 'develop' ]]
4848
then

.github/workflows/regression_test_full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
GITHUB_BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-)
1414
if [[ ! $GITHUB_BRANCH == 'main' ]] && [[ ! $GITHUB_BRANCH == 'develop' ]]
1515
then
16-
TAG=${GITHUB_BRANCH//\//_}
16+
TAG=`echo ${GITHUB_BRANCH} | sed 's/[^a-zA-Z0-9._]/-/g'`
1717
elif [[ $GITHUB_BRANCH == 'develop' ]]
1818
then
1919
TAG=nightly

.github/workflows/regression_test_lite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
if [[ ! $GITHUB_REF_NAME == 'main' ]] && [[ ! $GITHUB_REF_NAME == 'develop' ]]
3939
then
40-
TAG=${GITHUB_REF_NAME//\//_}
40+
TAG=`echo ${GITHUB_REF_NAME} | sed 's/[^a-zA-Z0-9._]/-/g'`
4141
elif [[ $GITHUB_REF_NAME == 'develop' ]]
4242
then
4343
TAG=nightly

.github/workflows/smoke_test_participant.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
GITHUB_BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-)
6969
if [[ ! $GITHUB_BRANCH == 'main' ]] && [[ ! $GITHUB_BRANCH == 'develop' ]]
7070
then
71-
TAG=${GITHUB_BRANCH//\//_}
71+
TAG=`echo ${GITHUB_BRANCH} | sed 's/[^a-zA-Z0-9._]/-/g'`
7272
elif [[ $GITHUB_BRANCH == 'develop' ]]
7373
then
7474
TAG=nightly
@@ -133,7 +133,7 @@ jobs:
133133
GITHUB_BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-)
134134
if [[ ! $GITHUB_BRANCH == 'main' ]] && [[ ! $GITHUB_BRANCH == 'develop' ]]
135135
then
136-
TAG=${GITHUB_BRANCH//\//_}
136+
TAG=`echo ${GITHUB_BRANCH} | sed 's/[^a-zA-Z0-9._]/-/g'`
137137
elif [[ $GITHUB_BRANCH == 'develop' ]]
138138
then
139139
TAG=nightly
@@ -192,7 +192,7 @@ jobs:
192192
GITHUB_BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-)
193193
if [[ ! $GITHUB_BRANCH == 'main' ]] && [[ ! $GITHUB_BRANCH == 'develop' ]]
194194
then
195-
TAG=${GITHUB_BRANCH//\//_}
195+
TAG=`echo ${GITHUB_BRANCH} | sed 's/[^a-zA-Z0-9._]/-/g'`
196196
elif [[ $GITHUB_BRANCH == 'develop' ]]
197197
then
198198
TAG=nightly

.ruff.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ external = ["T20"] # Don't autoremove 'noqa` comments for these rules
1313
"CPAC/utils/sklearn.py" = ["RUF003"]
1414
"CPAC/utils/tests/old_functions.py" = ["C", "D", "E", "EM", "PLW", "RET"]
1515
"CPAC/utils/utils.py" = ["T201"] # until `repickle` is removed
16+
"dev/circleci_data/conftest.py" = ["F401"]
1617
"setup.py" = ["D1"]
1718

1819
[lint.flake8-import-conventions.extend-aliases]

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
### Changed
2424

2525
- Moved `pygraphviz` from requirements to `graphviz` optional dependencies group.
26+
- Split `ResourcePool` into three classes: `Resource`, `ResourcePool`, and `StratPool`.
2627

2728
### Fixed
2829

CPAC/alff/alff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
from CPAC.alff.utils import get_opt_string
2424
from CPAC.pipeline import nipype_pipeline_engine as pe
25-
from CPAC.pipeline.nodeblock import nodeblock
25+
from CPAC.pipeline.engine.nodeblock import nodeblock
2626
from CPAC.registration.registration import apply_transform
2727
from CPAC.utils.interfaces import Function
2828
from CPAC.utils.utils import check_prov_for_regtool

CPAC/anat_preproc/anat_preproc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
wb_command,
3535
)
3636
from CPAC.pipeline import nipype_pipeline_engine as pe
37-
from CPAC.pipeline.nodeblock import nodeblock
37+
from CPAC.pipeline.engine.nodeblock import nodeblock
3838
from CPAC.utils.interfaces import Function
3939
from CPAC.utils.interfaces.fsl import Merge as fslMerge
4040

CPAC/conftest.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (C) 2024 C-PAC Developers
2+
3+
# This file is part of C-PAC.
4+
5+
# C-PAC is free software: you can redistribute it and/or modify it under
6+
# the terms of the GNU Lesser General Public License as published by the
7+
# Free Software Foundation, either version 3 of the License, or (at your
8+
# option) any later version.
9+
10+
# C-PAC is distributed in the hope that it will be useful, but WITHOUT
11+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13+
# License for more details.
14+
15+
# You should have received a copy of the GNU Lesser General Public
16+
# License along with C-PAC. If not, see <https://www.gnu.org/licenses/>.
17+
"""Global pytest configuration."""
18+
19+
from pathlib import Path
20+
21+
import pytest
22+
23+
24+
@pytest.fixture
25+
def bids_examples(cache: pytest.Cache) -> Path:
26+
"""Get cached example BIDS directories."""
27+
bids_dir = cache.mkdir("bids-examples").absolute()
28+
if not (bids_dir.exists() and list(bids_dir.iterdir())):
29+
from git import Repo
30+
31+
Repo.clone_from("https://github.com/bids-standard/bids-examples.git", bids_dir)
32+
return bids_dir

0 commit comments

Comments
 (0)