-
Notifications
You must be signed in to change notification settings - Fork 116
/
Makefile
53 lines (40 loc) · 1.21 KB
/
Makefile
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
IMAGE := nbeats
ROOT := $(shell dirname $(realpath $(firstword ${MAKEFILE_LIST})))
EXPERIMENT_ID = $(subst /,_,${name})_${config}
DOCKER_PARAMETERS := \
--user $(shell id -u) \
-v ${ROOT}:/experiment \
-w /experiment \
-e PYTHONPATH=/experiment \
-e STORAGE=/experiment/storage
ifdef gpu
DOCKER_PARAMETERS += --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=$(gpu)
endif
.PHONY: test
init:
docker build . -t ${IMAGE}
dataset:
docker run -it --rm ${DOCKER_PARAMETERS} ${IMAGE} python datasets/main.py build
build: .require-config
docker run -it --rm ${DOCKER_PARAMETERS} ${IMAGE} \
python $(dir ${config})main.py --config_path=${config} build_ensemble
run: .require-command
docker run -it --rm ${DOCKER_PARAMETERS} ${IMAGE} \
bash -c "`cat ${ROOT}/${command}`"
notebook: .require-port
docker run -d --rm ${DOCKER_PARAMETERS} -e HOME=/tmp -p $(port):8888 $(IMAGE) \
bash -c "jupyter lab --ip=0.0.0.0 --no-browser --NotebookApp.token=''"
test:
docker run -it --rm ${DOCKER_PARAMETERS} ${IMAGE} python -m unittest
.require-config:
ifndef config
$(error config is required)
endif
.require-command:
ifndef command
$(error command is required)
endif
.require-port:
ifndef port
$(error port is required)
endif