Skip to content

Commit 63fc9c6

Browse files
authored
Entry points accept configuration files at runtime (Inria-Empenn#240)
* Runner allows for configuration at runtime * Other scripts allow for configuration at runtime * Documentation update * New actions versions
1 parent cdeedd2 commit 63fc9c6

File tree

13 files changed

+61
-7
lines changed

13 files changed

+61
-7
lines changed

.github/workflows/code_quality.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
# Steps that define the job
2626
steps:
2727
- name: Checkout repository
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929

3030
- name: Set up Python
31-
uses: actions/setup-python@v3
31+
uses: actions/setup-python@v4
3232
with:
3333
python-version: 3.9
3434

@@ -50,7 +50,7 @@ jobs:
5050
pylint --fail-under 8 tests > pylint_report_tests.txt
5151
5252
- name: Archive pylint results
53-
uses: actions/upload-artifact@v3
53+
uses: actions/upload-artifact@v4
5454
if: failure() # Only if previous step failed
5555
with:
5656
name: pylint-reports-python

.github/workflows/codespell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121
- name: Codespell
2222
uses: codespell-project/actions-codespell@v2

.github/workflows/pipeline_status.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout main branch
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
with:
2727
ref: main
2828

2929
- name: Checkout wiki
30-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
3131
with:
3232
repository: ${{github.repository}}.wiki
3333
path: wiki
3434

3535
- name: Set up Python 3.9
36-
uses: actions/setup-python@v3
36+
uses: actions/setup-python@v4
3737
with:
3838
python-version: 3.9
3939

docs/data.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ narps_results -h
8888
a list of team IDs
8989
-a, --all download results from all teams
9090
-r, --rectify rectify the results
91+
--config CONFIG custom configuration file to be used
9192

9293
# Either download all collections
9394
narps_results -a

docs/description.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ narps_description -h
2828
# the sub dictionary of team description
2929
# --json output team description as JSON
3030
# --md output team description as Markdown
31+
# --config CONFIG custom configuration file to be used
3132

3233
narps_description -t 2T6S --json
3334
# {

docs/running.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ narps_open_runner -h
3030
the analysis levels to run (p=preprocessing, r=run, s=subject, g=group)
3131
-c, --check check pipeline outputs (runner is not launched)
3232
-e, --exclusions run the analyses without the excluded subjects
33+
--config CONFIG custom configuration file to be used
3334

3435
narps_open_runner -t 2T6S -s 001 006 020 100 # Launches the full pipeline on the given subjects
3536
narps_open_runner -t 2T6S -r 4 # Launches the full pipeline on 4 random subjects

docs/status.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ narps_open_status -h
5959
# -h, --help show this help message and exit
6060
# --json output the report as JSON
6161
# --md output the report as Markdown
62+
# --config CONFIG custom configuration file to be used
6263

6364
narps_open_status --json
6465
# {

narps_open/data/description/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ def main():
3030
formats = parser.add_mutually_exclusive_group(required = False)
3131
formats.add_argument('--json', action='store_true', help='output team description as JSON')
3232
formats.add_argument('--md', action='store_true', help='output team description as Markdown')
33+
parser.add_argument('--config', type=str, required=False,
34+
help='custom configuration file to be used')
3335
arguments = parser.parse_args()
3436

37+
# Init configuration
38+
if arguments.config:
39+
Configuration('custom').config_file = arguments.config
40+
3541
# Initialize a TeamDescription
3642
information = TeamDescription(team_id = arguments.team)
3743

narps_open/data/results/__main__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ def main():
1919
group.add_argument('-a', '--all', action='store_true', help='download results from all teams')
2020
parser.add_argument('-r', '--rectify', action='store_true', default = False, required = False,
2121
help='rectify the results')
22+
parser.add_argument('--config', type=str, required=False,
23+
help='custom configuration file to be used')
2224
arguments = parser.parse_args()
2325

26+
# Init configuration
27+
if arguments.config:
28+
Configuration('custom').config_file = arguments.config
29+
30+
# Start collecting result data
2431
factory = ResultsCollectionFactory()
2532

2633
if arguments.all:

narps_open/runner.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,19 @@ def main():
226226
help='check pipeline outputs (runner is not launched)')
227227
parser.add_argument('-e', '--exclusions', action='store_true', required=False,
228228
help='run the analyses without the excluded subjects')
229+
parser.add_argument('--config', type=str, required=False,
230+
help='custom configuration file to be used')
229231
arguments = parser.parse_args()
230232

231233
# Check arguments
232234
if arguments.exclusions and not arguments.nsubjects:
233235
print('Argument -e/--exclusions only works with -n/--nsubjects')
234236
return
235237

238+
# Init configuration
239+
if arguments.config:
240+
Configuration('custom').config_file = arguments.config
241+
236242
# Initialize a PipelineRunner
237243
runner = PipelineRunner(team_id = arguments.team)
238244
runner.pipeline.directories.dataset_dir = Configuration()['directories']['dataset']

0 commit comments

Comments
 (0)