-
Notifications
You must be signed in to change notification settings - Fork 1
/
rcc.sh
executable file
·756 lines (577 loc) · 22 KB
/
rcc.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
#!/bin/bash
# rich context contest bash script
#===============================================================================
# variables
#===============================================================================
# load config
config_file_path="./config.sh"
action_arg="1"
while getopts "c:" opt; do
case $opt in
c) config_file_path="$OPTARG"
action_arg="3"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
# other variables
current_time_stamp=$(date +%Y-%m-%d-%H-%M-%S)
archive_folder_path=
now_archive_folder_path=
empty_value="EMPTYEMPTYEMPTYEMPTY"
#===============================================================================
# functions
#===============================================================================
# return reference
absolute_path_OUT=
function absolute_path()
{
# input parameters
local path_IN=$1
# declare variables
local absolute_path=
# clear output reference
absolute_path_OUT=
# call realpath
#absolute_path=$( realpath "${1}" )
# call readlink -f
#absolute_path=$( readlink -f "${1}" )
# something less platform-specific:
# https://stackoverflow.com/questions/4175264/bash-retrieve-absolute-path-given-relative
absolute_path="$(cd "$(dirname "${1}")"; pwd)/$(basename "${1}")"
# return result
absolute_path_OUT="${absolute_path}"
} #-- END function absolute_path() --#
function init_archive_folders()
{
# Accepts base folder path, makes sure an archive folder exists and
# then checks for a nested folder for the current run's timestamp.
# If no time stamp folder, creates one, as well.
# Postconditions: sets archive_folder_path and now_archive_folder_path
# to the paths it initializes.
# input parameters
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
# declare variables
local time_stamp="${current_time_stamp}"
# check if ./archive folder
archive_folder_path="${base_folder_path_IN}/archive"
if [[ ! -d "${archive_folder_path}" ]]
then
# no archive folder. Create one.
mkdir "${archive_folder_path}"
fi
# create nested folder from date-time?
now_archive_folder_path="${archive_folder_path}/${time_stamp}"
if [[ ! -d "${now_archive_folder_path}" ]]
then
# no current timestamp folder. Create one.
mkdir "${now_archive_folder_path}"
fi
} #-- END function init_archive_folders() --#
function reset_folder()
{
# input parameters
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
local git_folder_path_IN=${2:=${GIT_REPO_FOLDER_PATH_IN}}
local folder_name_IN=${3:=${empty_value}}
# declare variables
local folder_path=
local template_folder_path=
local is_folder_present=false
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In reset_folder()"
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- git_folder_path_IN: \"${git_folder_path_IN}\""
echo "- folder_name_IN: \"${folder_name_IN}\""
fi
# got a folder name?
if [[ folder_name_IN != "${empty_value}" ]]
then
# initialize paths
folder_path="${base_folder_path_IN}/${folder_name_IN}"
template_folder_path="${git_folder_path_IN}/${folder_name_IN}"
# check if folder currently in the base directory.
if [[ -d "${folder_path}" ]]
then
# folder present.
is_folder_present=true
fi
# need to archive project folder?
if [[ $is_folder_present = true ]]
then
# yes - make sure archive folders are initialized
# - sets archive_folder_path and now_archive_folder_path
init_archive_folders "${base_folder_path_IN}"
# move folder to now_archive_folder_path
mv "${folder_path}" "${now_archive_folder_path}"
echo "==> ARCHIVE: Moved existing folder \"${folder_name_IN}\" from ${folder_path} to ${now_archive_folder_path}"
fi #-- END check if need to archive --#
# copy stuff from git repo.
# does git repo path exist?
if [[ -d "${git_folder_path_IN}" ]]
then
# it does - copy "project" folder to base folder...
cp -R "${template_folder_path}" "${base_folder_path_IN}"
fi #-- END check to see if git folder --#
fi #-- END check for folder name. --#
} #-- END function reset_folder() --#
function reset_data_folder()
{
# input parameters
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
local git_folder_path_IN=${2:=${GIT_REPO_FOLDER_PATH_IN}}
# declare variables
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In reset_data_folder():"
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- git_folder_path_IN: \"${git_folder_path_IN}\""
fi
# data folder - if present, archive, then move over new copy of original.
reset_folder "${base_folder_path_IN}" "${git_folder_path_IN}" "data"
} #-- END function reset_data_folder() --#
function reset_project_folder()
{
# input parameters
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
local git_folder_path_IN=${2:=${GIT_REPO_FOLDER_PATH_IN}}
# declare variables
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In reset_project_folder():"
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- git_folder_path_IN: \"${git_folder_path_IN}\""
fi
# project folder - if present, archive, then move over new copy of original.
reset_folder "${base_folder_path_IN}" "${git_folder_path_IN}" "project"
} #-- END function reset_project_folder() --#
function reset_file()
{
# "replace" means archive current out of the way, then
# copy new in. Existing is replaced, not overwritten.
# input parameters - all required
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
local git_folder_path_IN=${2:=${GIT_REPO_FOLDER_PATH_IN}}
local file_name_IN=${3:=${empty_value}}
local do_replace_IN=${4:-false}
local template_path_IN=${5:-${empty_value}}
# declare variables
local file_name=
local file_path=
local template_file_path=
# do we have a file name?
if [[ $file_name_IN != $empty_value ]]
then
# init file info
file_name="${file_name_IN}"
file_path="${base_folder_path_IN}/${file_name}"
if [[ $template_path_IN != $empty_value ]]
then
# include additional path information.
template_file_path="${git_folder_path_IN}/${template_path_IN}/${file_name}"
else
# no additional path information.
template_file_path="${git_folder_path_IN}/${file_name}"
fi
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In reset_file()"
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- git_folder_path_IN: \"${git_folder_path_IN}\""
echo "- file_name_IN: \"${file_name_IN}\""
echo "- do_replace_IN: \"${do_replace_IN}\""
echo "- template_path_IN: \"${template_path_IN}\""
fi
# does git repo path exist?
if [[ -d "${git_folder_path_IN}" ]]
then
# do we replace?
if [[ $do_replace_IN = true ]]
then
# check if file already there.
if [[ -f "${file_path}" ]]
then
# yes - make sure archive folders are initialized
# - sets archive_folder_path and now_archive_folder_path
init_archive_folders "${base_folder_path_IN}"
# move the current file to "${now_archive_folder_path}"
mv "${file_path}" "${now_archive_folder_path}"
echo "==> ARCHIVE: Moved existing ${file_name} from ${file_path} to ${now_archive_folder_path}"
fi #-- END check if file present. --#
fi #-- END check to see if we are replacing --#
# copy into place if not already present.
if [[ ! -f "${file_path}" ]]
then
# copy
cp "${template_file_path}" "${base_folder_path_IN}"
fi #-- check if file present --#
fi #-- END check to see if git repo path --#
else
echo "ERROR: You must pass in a file name."
fi #-- END check to see if file name --#
} #-- END function reset_file() --#
function reset_config_file()
{
# input parameters
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
local git_folder_path_IN=${2:=${GIT_REPO_FOLDER_PATH_IN}}
local do_replace_IN=${3:-true}
# declare variables
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In reset_config_file():"
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- git_folder_path_IN: \"${git_folder_path_IN}\""
echo "- do_replace_IN: \"${do_replace_IN}\""
fi
# reset config file, archive and replace as requested if already there.
reset_file "${base_folder_path_IN}" "${git_folder_path_IN}" "config.sh" "${do_replace_IN}" "templates"
} #-- END function reset_config_file() --#
function reset_dockerfile()
{
# input parameters
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
local git_folder_path_IN=${2:=${GIT_REPO_FOLDER_PATH_IN}}
local do_replace_IN=${3:-true}
# declare variables
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In reset_dockerfile():"
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- git_folder_path_IN: \"${git_folder_path_IN}\""
echo "- do_replace_IN: \"${do_replace_IN}\""
fi
# reset Dockerfile, archive and replace if already there.
reset_file "${base_folder_path_IN}" "${git_folder_path_IN}" "Dockerfile" "${do_replace_IN}"
} #-- END function reset_dockerfile() --#
function reset_rcc_script()
{
# input parameters
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
local git_folder_path_IN=${2:=${GIT_REPO_FOLDER_PATH_IN}}
local do_replace_IN=${3:-true}
# declare variables
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In reset_rcc_script():"
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- git_folder_path_IN: \"${git_folder_path_IN}\""
echo "- do_replace_IN: \"${do_replace_IN}\""
fi
# reset rcc.sh, archive and replace if already there.
reset_file "${base_folder_path_IN}" "${git_folder_path_IN}" "rcc.sh" "${do_replace_IN}"
chmod 775 "${base_folder_path_IN}/rcc.sh"
} #-- END function reset_rcc_script() --#
function init()
{
# input parameters
local base_folder_path_IN=${1:=${BASE_FOLDER_PATH_IN}}
local git_folder_path_IN=${2:=${GIT_REPO_FOLDER_PATH_IN}}
# declare variables
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In init():"
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- git_folder_path_IN: \"${git_folder_path_IN}\""
fi
# data folder - if present, archive, then move over new copy of original.
reset_data_folder "${base_folder_path_IN}" "${git_folder_path_IN}"
# project folder - if present, archive, then move over new copy of original.
reset_project_folder "${base_folder_path_IN}" "${git_folder_path_IN}"
# reset config file, but don't replace if already there.
reset_config_file "${base_folder_path_IN}" "${git_folder_path_IN}" false
# reset Dockerfile, but don't replace if already there.
reset_dockerfile "${base_folder_path_IN}" "${git_folder_path_IN}" false
# reset rcc.sh script, replace if already there.
reset_rcc_script "${base_folder_path_IN}" "${git_folder_path_IN}" true
} #-- END function init() --#
#build:
# docker build -t my_rcc --force-rm .
function build()
{
# input parameters
local image_name_IN=${1:=${DOCKER_IMAGE_NAME_IN}}
local base_folder_path_IN=${2:=${BASE_FOLDER_PATH_IN}}
local use_cache_IN=${3:-${USE_BUILD_CACHE_IN}}
# declare variables
cache_flag=
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In build():"
echo "- image_name_IN: \"${image_name_IN}\""
echo "- base_folder_path_IN: \"${base_folder_path_IN}\""
echo "- use_cache_IN: \"${use_cache_IN}\""
fi
# DEBUG
if [[ $use_cache_IN = false ]]
then
cache_flag="--no-cache"
fi
# run the docker command.
docker build ${cache_flag} -t ${image_name_IN} --force-rm ${base_folder_path_IN}
} #-- END function build() --#
# stop:
# docker rm -f my_rcc_run
function stop()
{
# input parameters
local container_name_IN=${1:=${DOCKER_CONTAINER_NAME_IN}}
# declare variables
# DEBUG
if [[ $DEBUG = true ]]
then
echo "container_name_IN: \"${container_name_IN}\""
fi
# run the docker command.
docker rm -f ${container_name_IN}
} #-- END function stop() --#
# remove_docker_image:
function remove_docker_image()
{
# input parameters
local image_name_IN=${1:-${DOCKER_IMAGE_NAME_IN}}
# declare variables
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In remove_docker_image:"
echo "- image_name_IN: \"${image_name_IN}\""
fi
# remove JSON files from output.
docker rmi "${image_name_IN}"
} #-- END function remove_docker_image() --#
#run:
# docker run -v `pwd`/project:/project -v `pwd`/data:/data --name my_rcc_run my_rcc /project/code.sh
#evaluate:
# docker run -v `pwd`/project:/project -v `pwd`/data:/data --name my_rcc_run my_rcc /data/evaluate/evaluate.sh
function run()
{
# input parameters
local project_folder_path_IN=${1:=${PROJECT_FOLDER_PATH_IN}}
local data_folder_path_IN=${2:=${DATA_FOLDER_PATH_IN}}
local image_name_IN=${3:=${DOCKER_IMAGE_NAME_IN}}
local container_name_IN=${4:=${DOCKER_CONTAINER_NAME_IN}}
local script_to_run_IN=${5:-}
# declare variables
local project_folder_path=
local data_folder_path=
# convert to absolute paths.
# project folder path
absolute_path "${project_folder_path_IN}"
project_folder_path="${absolute_path_OUT}"
# data folder path
absolute_path "${data_folder_path_IN}"
data_folder_path="${absolute_path_OUT}"
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In run:"
echo "- project_folder_path_IN: \"${project_folder_path_IN}\""
echo "- data_folder_path_IN: \"${data_folder_path_IN}\""
echo "- project_folder_path: \"${project_folder_path}\""
echo "- data_folder_path: \"${data_folder_path}\""
echo "- image_name_IN: \"${image_name_IN}\""
echo "- container_name_IN: \"${container_name_IN}\""
fi
# remove JSON files from output.
docker run -v `pwd`:/run_folder -v ${project_folder_path}:/project -v ${data_folder_path}:/data --name ${container_name_IN} ${image_name_IN} ${script_to_run_IN}
} #-- END function run() --#
#run-interactive:
# docker run -it -v `pwd`/project:/project -v `pwd`/data:/data --name my_rcc_run my_rcc
function run_interactive()
{
# input parameters
local project_folder_path_IN=${1:=${PROJECT_FOLDER_PATH_IN}}
local data_folder_path_IN=${2:=${DATA_FOLDER_PATH_IN}}
local image_name_IN=${3:=${DOCKER_IMAGE_NAME_IN}}
local container_name_IN=${4:=${DOCKER_CONTAINER_NAME_IN}}
# declare variables
local project_folder_path=
local data_folder_path=
# convert to absolute paths.
# project folder path
absolute_path "${project_folder_path_IN}"
project_folder_path="${absolute_path_OUT}"
# data folder path
absolute_path "${data_folder_path_IN}"
data_folder_path="${absolute_path_OUT}"
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In run_interactive():"
echo "- project_folder_path_IN: \"${project_folder_path_IN}\""
echo "- data_folder_path_IN: \"${data_folder_path_IN}\""
echo "- project_folder_path: \"${project_folder_path}\""
echo "- data_folder_path: \"${data_folder_path}\""
echo "- image_name_IN: \"${image_name_IN}\""
echo "- container_name_IN: \"${container_name_IN}\""
fi
# run in interactive mode ("-it").
docker run -it -v `pwd`:/run_folder -v ${project_folder_path}:/project -v ${data_folder_path}:/data --name ${container_name_IN} ${image_name_IN}
} #-- END function run_interactive() --#
#git-pull:
function git_pull()
{
# input parameters
local project_folder_path_IN=${1:=${PROJECT_FOLDER_PATH_IN}}
local data_folder_path_IN=${2:=${DATA_FOLDER_PATH_IN}}
local image_name_IN=${3:=${DOCKER_IMAGE_NAME_IN}}
local container_name_IN=${4:=${DOCKER_CONTAINER_NAME_IN}}
# declare variables
local project_folder_path=
local data_folder_path=
# convert to absolute paths.
# project folder path
absolute_path "${project_folder_path_IN}"
project_folder_path="${absolute_path_OUT}"
# data folder path
absolute_path "${data_folder_path_IN}"
data_folder_path="${absolute_path_OUT}"
# DEBUG
if [[ $DEBUG = true ]]
then
echo "In git_pull():"
echo "- project_folder_path_IN: \"${project_folder_path_IN}\""
echo "- data_folder_path_IN: \"${data_folder_path_IN}\""
echo "- project_folder_path: \"${project_folder_path}\""
echo "- data_folder_path: \"${data_folder_path}\""
echo "- image_name_IN: \"${image_name_IN}\""
echo "- container_name_IN: \"${container_name_IN}\""
fi
# pull inside container.
#run "${project_folder_path}" "${data_folder_path}" "${image_name_IN}" "${container_name_IN}" "/rich-context-competition/bin/git_pull.sh"
# stop the container.
#stop "${container_name_IN}"
# if rich-context-competition folder exists, cd into it.
if [[ -d "rich-context-competition" ]]
then
cd rich-context-competition
fi
# do a local pull
git pull
} #-- END function git_pull() --#
#===============================================================================
# main
#===============================================================================
# This will load (including default values):
# BASE_FOLDER_IN="."
# GIT_REPO_FOLDER_PATH_IN="${BASE_FOLDER_IN}/rich-context-competition"
# EVALUATE_FOLDER_PATH_IN="${GIT_REPO_FOLDER_PATH_IN}/data/evaluate"
# TEMPLATE_FOLDER_PATH_IN="${GIT_REPO_FOLDER_PATH_IN}/templates"
# DATA_FOLDER_PATH_IN="${BASE_FOLDER_IN}/data"
# PROJECT_FOLDER_PATH_IN="${BASE_FOLDER_IN}/project"
# DEBUG=false
if [[ -f "${config_file_path}" ]]
then
# load the configuration
source "${config_file_path}"
# retrieve the requested action.
requested_action=${!action_arg}
# DEBUG
if [[ $DEBUG = true ]]
then
echo "Config file path: \"${config_file_path}\""
echo "Requested action: \"${requested_action}\""
fi
# do the important work:
case "${requested_action}" in
"build")
echo "BUILD!!!"
build "${DOCKER_IMAGE_NAME_IN}" "${BASE_FOLDER_PATH_IN}"
;;
"build-no-cache")
echo "BUILD NO CACHE!!!"
build "${DOCKER_IMAGE_NAME_IN}" "${BASE_FOLDER_PATH_IN}" false
;;
"build-use-cache")
echo "BUILD USE CACHE!!!"
build "${DOCKER_IMAGE_NAME_IN}" "${BASE_FOLDER_PATH_IN}" true
;;
"evaluate")
echo "EVALUATE!!!"
run "${PROJECT_FOLDER_PATH_IN}" "${DATA_FOLDER_PATH_IN}" "${DOCKER_IMAGE_NAME_IN}" "${DOCKER_CONTAINER_NAME_IN}" "/rich-context-competition/evaluate/evaluate.sh"
./rcc.sh stop
;;
"init")
echo "INIT!!!"
init "${BASE_FOLDER_PATH_IN}" "${GIT_REPO_FOLDER_PATH_IN}"
;;
"remove-docker-image")
echo "REMOVE DOCKER IMAGE!!!"
remove_docker_image "${DOCKER_IMAGE_NAME_IN}"
;;
"reset-data-folder")
echo "RESET DATA FOLDER!!!"
reset_data_folder "${BASE_FOLDER_PATH_IN}" "${GIT_REPO_FOLDER_PATH_IN}"
;;
"reset-project-folder")
echo "RESET PROJECT FOLDER!!!"
reset_project_folder "${BASE_FOLDER_PATH_IN}" "${GIT_REPO_FOLDER_PATH_IN}"
;;
"reset-config-file")
echo "RESET config.sh FILE!!!"
reset_config_file "${BASE_FOLDER_PATH_IN}" "${GIT_REPO_FOLDER_PATH_IN}" true
;;
"reset-dockerfile")
echo "RESET Dockerfile!!!"
reset_dockerfile "${BASE_FOLDER_PATH_IN}" "${GIT_REPO_FOLDER_PATH_IN}" true
;;
"reset-rcc-script")
echo "RESET rcc.sh SCRIPT!!!"
reset_rcc_script "${BASE_FOLDER_PATH_IN}" "${GIT_REPO_FOLDER_PATH_IN}"
;;
"run")
echo "RUN!!!"
run "${PROJECT_FOLDER_PATH_IN}" "${DATA_FOLDER_PATH_IN}" "${DOCKER_IMAGE_NAME_IN}" "${DOCKER_CONTAINER_NAME_IN}" "/project/code.sh"
;;
"run-interactive")
echo "RUN INTERACTIVE!!!"
run_interactive "${PROJECT_FOLDER_PATH_IN}" "${DATA_FOLDER_PATH_IN}" "${DOCKER_IMAGE_NAME_IN}" "${DOCKER_CONTAINER_NAME_IN}"
;;
"run-stop")
echo "RUN THEN STOP!!!"
run "${PROJECT_FOLDER_PATH_IN}" "${DATA_FOLDER_PATH_IN}" "${DOCKER_IMAGE_NAME_IN}" "${DOCKER_CONTAINER_NAME_IN}" "/project/code.sh"
./rcc.sh stop
;;
"stop")
echo "STOP!!!"
stop "${DOCKER_CONTAINER_NAME_IN}"
;;
*)
echo ""
echo "Requested action \"${requested_action}\" is not valid."
echo ""
echo "Valid actions:"
echo "- build"
echo "- build-no-cache"
echo "- build-use-cache"
echo "- evaluate"
echo "- init"
echo "- remove-docker-image"
echo "- reset-data-folder"
echo "- reset-project-folder"
echo "- reset-config-file"
echo "- reset-dockerfile"
echo "- reset-rcc-script"
echo "- run"
echo "- run-interactive"
echo "- run-stop"
echo "- stop"
echo ""
;;
esac
else
# no configuration file. error.
echo "No file at path \"${config_file_path}\""
fi