Skip to content

Commit

Permalink
Fix jupyter with tiny dataset and add tests (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Yushkovskiy authored Jun 4, 2020
1 parent 5d8a092 commit 7524b1c
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 180 deletions.
23 changes: 15 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
name: Install Dependencies, Configure Environment
command: |
pip install --user -r .circleci/requirements.txt
neuro config login-with-token $NEURO_TOKEN
neuro config login-with-token $NEURO_TOKEN $NEURO_URL
neuro config show
- run:
Expand All @@ -49,9 +49,10 @@ jobs:
make setup __BAKE_SETUP=yes | tee
export RUN_EXTRA="--tag=$JOBS_TAG"
make -f test.mk test_jupyter TRAINING_MACHINE_TYPE=cpu-small | tee
# note: with cpu-small, we get "Kernel died while waiting for execute reply"
make -f test.mk test_jupyter TRAINING_MACHINE_TYPE=cpu-large | tee
make -f test.mk test_jupyter TRAINING_MACHINE_TYPE=gpu-small | tee
make -f test.mk test_jupyter_baked TRAINING_MACHINE_TYPE=cpu-small | tee
make -f test.mk test_jupyter_baked TRAINING_MACHINE_TYPE=cpu-large | tee
make -f test.mk test_jupyter_baked TRAINING_MACHINE_TYPE=gpu-small | tee
- run:
Expand Down Expand Up @@ -79,7 +80,7 @@ jobs:
- docker/check
- docker/push:
image: neuromation/ml-recipe-bone-age
image: $PROJECT_NAME
tag: $CIRCLE_TAG,latest


Expand All @@ -88,14 +89,20 @@ workflows:

main:
jobs:
- build_and_test

- build_and_test:
filters:
tags:
only:
- /.*/

- deploy:
requires:
- build_and_test
filters:
branches:
only:
- master
ignore:
- /.*/
tags:
only:
- /.*/
- /.*/
3 changes: 2 additions & 1 deletion .circleci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
neuromation>=20.4.6
neuromation>=20.4.15
certifi>=2020.4.5.1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ dmypy.json

# data/ folder
# data/**/*
wget-log
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ CODE_DIR?=src
NOTEBOOKS_DIR?=notebooks
RESULTS_DIR?=results

PROJECT_FILES=requirements.txt apt.txt setup.cfg
PROJECT_FILES=requirements.txt apt.txt setup.cfg download_data.sh

PROJECT_PATH_STORAGE?=storage:ml-recipe-bone-age

PROJECT_PATH_ENV?=/ml-recipe-bone-age

DATA_ROOT_STORAGE=storage:/neuromation/public/ml-recipe-bone-age
DATA_ROOT_PATH_ENV=/data

##### JOB NAMES #####
Expand Down Expand Up @@ -129,12 +128,12 @@ training: upload-code ### Run a training job
$(NEURO) run $(RUN_EXTRA) \
--name $(TRAINING_JOB) \
--preset $(TRAINING_MACHINE_TYPE) \
--volume $(DATA_ROOT_STORAGE):$(DATA_ROOT_PATH_ENV):ro \
--volume $(PROJECT_PATH_STORAGE)/$(CODE_DIR):$(PROJECT_PATH_ENV)/$(CODE_DIR):ro \
--volume $(PROJECT_PATH_STORAGE)/$(RESULTS_DIR):$(PROJECT_PATH_ENV)/$(RESULTS_DIR):rw \
--env EXPOSE_SSH=yes \
$(CUSTOM_ENV_NAME) \
bash -c 'cd $(PROJECT_PATH_ENV) && \
sh download_data.sh bone-age-full.zip $(DATA_ROOT_PATH_ENV) && \
python -u $(CODE_DIR)/train.py \
--data_dir=$(DATA_ROOT_PATH_ENV)/data/train \
--annotation_csv=$(DATA_ROOT_PATH_ENV)/data/train.csv'
Expand All @@ -155,7 +154,6 @@ jupyter: upload-code upload-notebooks ### Run a job with Jupyter Notebook and op
--http 8888 \
$(HTTP_AUTH) \
--browse \
--volume $(DATA_ROOT_STORAGE):$(DATA_ROOT_PATH_ENV):ro \
--volume $(PROJECT_PATH_STORAGE):$(PROJECT_PATH_ENV):rw \
$(CUSTOM_ENV_NAME) \
$(JUPYTER_CMD)
Expand Down Expand Up @@ -188,7 +186,6 @@ filebrowser: ### Run a job with File Browser and open UI in the default browser
--http 80 \
$(HTTP_AUTH) \
--browse \
--volume $(DATA_ROOT_STORAGE):$(DATA_ROOT_PATH_ENV):ro \
--volume $(PROJECT_PATH_STORAGE):/srv:rw \
filebrowser/filebrowser \
--noauth
Expand Down
253 changes: 95 additions & 158 deletions notebooks/demo.ipynb

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@ CMD_NBCONVERT=\
--to=asciidoc \
--ExecutePreprocessor.timeout=1000 \
--output=/tmp/out \
$(PROJECT_PATH_ENV)/$(NOTEBOOKS_DIR)/demo.ipynb && \
echo "Test succeeded: PROJECT_PATH_ENV=$(PROJECT_PATH_ENV) TRAINING_MACHINE_TYPE=$(TRAINING_MACHINE_TYPE)"
$(PROJECT_PATH_ENV)/$(NOTEBOOKS_DIR)/demo.ipynb

SUCCESS_MSG="[+] Test succeeded: PROJECT_PATH_ENV=$(PROJECT_PATH_ENV) TRAINING_MACHINE_TYPE=$(TRAINING_MACHINE_TYPE)"


.PHONY: test_jupyter
test_jupyter: JUPYTER_CMD=bash -c '$(CMD_PREPARE) && $(CMD_NBCONVERT)'
test_jupyter: jupyter
# kill job to set its SUCCEEDED status in platform-api
make kill-jupyter
@echo $(SUCCESS_MSG)


.PHONY: test_jupyter_baked
test_jupyter_baked: PROJECT_PATH_ENV=/project-local
test_jupyter_baked: JOB_NAME=jupyter-baked-$(PROJECT_POSTFIX)
test_jupyter_baked: JOB_NAME=$(JUPYTER_JOB)-baked
test_jupyter_baked:
$(NEURO) run $(RUN_EXTRA) \
--name $(JOB_NAME) \
--preset $(TRAINING_MACHINE_TYPE) \
--volume $(DATA_ROOT_STORAGE):$(DATA_ROOT_PATH_ENV):ro \
$(CUSTOM_ENV_NAME) \
bash -c '$(CMD_PREPARE) && $(CMD_NBCONVERT)'
# kill job to set its SUCCEEDED status in platform-api
$(NEURO) kill $(JOB_NAME) || :
@echo $(SUCCESS_MSG)

0 comments on commit 7524b1c

Please sign in to comment.