forked from sgiavasis/CPAC_regtest_pack
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_cpac_container_fmriprep-options.sh
executable file
·126 lines (111 loc) · 3.63 KB
/
run_cpac_container_fmriprep-options.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
# usage
# > ./run_cpac_container.sh {docker tag} {run label} {mode}
# /\ optional
# {mode} options:
# (leave this blank to simply run C-PAC)
# - enter = enter the container instead of running C-PAC
# - current = use C-PAC install from code in current branch of C-PAC repo listed in "repo"
# - enter-current = enter the container instead of running, with C-PAC install from code
# in current branch of C-PAC repo listed in "repo"
docker_image=$1
name=$2
mode=$3
if [[ -z "$name" ]]
then
name="test"
fi
# Custom args for this run
#-------------------------
# Paths
run_name="${name}_fmriprep-options"
repo="/media/ebs/C-PAC"
# Data
data_config="/media/ebs/CPAC_regtest_pack/data_config_regtest_quick_incomplete.yml"
bids_dir=/home/ubuntu # keep as /home/ubuntu when providing a data_config
#bids_dir="s3://fcp-indi/data/etc."
# Pipeline
pipe_config="/media/ebs/runs/configs/pipe_fmriprep-opts_antsmult.yml"
#preconfig="fmriprep-options" # preconfig will override pipe_config
# Run settings
cpu_max=16
n_cpus=16
ants_cpus=10
mem_gb=20
#-------------------------
if [[ -z "$data_config" ]]
then
data_map="-v $bids_dir:$bids_dir"
data_config=""
else
data_map="-v $data_config:/configs/data_config.yml"
data_config="--data_config_file /configs/data_config.yml"
fi
if [[ -z "$pipe_config" ]]
then
pipe_map="-v /tmp:/tmp"
pipe_config=""
else
pipe_map="-v $pipe_config:/configs/pipe_config.yml"
pipe_config="--pipeline_file /configs/pipe_config.yml"
fi
if [[ "$preconfig" ]]
then
pipe_config="--preconfig $preconfig"
fi
if [[ $mode = "enter" ]]
then
sudo docker run -it \
-v /home/ubuntu:/home/ubuntu \
-v /media/ebs/CPAC_regtest_pack:/media/ebs/CPAC_regtest_pack \
-v /media/ebs/runs/$run_name:/output \
--entrypoint bash \
$docker_image
elif [[ $mode = "enter-current" ]]
then
sudo docker run -it \
-v $repo/CPAC:/code/CPAC \
-v $repo/dev/docker_data/run.py:/code/run.py \
-v $repo/dev/docker_data:/cpac_resources \
-v $repo/dev/docker_data/bids_utils.py:/code/bids_utils.py \
-v $repo/dev/docker_data/default_pipeline.yml:/code/default_pipeline.yml \
-v /home/ubuntu:/home/ubuntu \
-v /media/ebs/CPAC_regtest_pack:/media/ebs/CPAC_regtest_pack \
-v /media/ebs/runs/$run_name:/output \
--entrypoint bash \
$docker_image
elif [[ $mode = "current" ]]
then
sudo docker run \
-v $repo/CPAC:/code/CPAC \
-v $repo/dev/docker_data/run.py:/code/run.py \
-v $repo/dev/docker_data:/cpac_resources \
-v $repo/dev/docker_data/bids_utils.py:/code/bids_utils.py \
-v $repo/dev/docker_data/default_pipeline.yml:/code/default_pipeline.yml \
-v /home/ubuntu:/home/ubuntu \
-v /media/ebs/CPAC_regtest_pack:/media/ebs/CPAC_regtest_pack \
-v /media/ebs/runs/$run_name:/output \
$data_map \
$pipe_map \
$docker_image $bids_dir /output participant \
--save_working_dir \
--skip_bids_validator \
--n_cpus $cpu_max \
--mem_gb $mem_gb \
$data_config \
$pipe_config
else
sudo docker run \
-v /home/ubuntu:/home/ubuntu \
-v /media/ebs/CPAC_regtest_pack:/media/ebs/CPAC_regtest_pack \
-v /media/ebs/runs/$run_name:/output \
$data_map \
$pipe_map \
$docker_image $bids_dir /output participant \
--save_working_dir \
--skip_bids_validator \
--n_cpus $cpu_max \
--mem_gb $mem_gb \
$data_config \
$pipe_config
fi