-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (104 loc) · 3.24 KB
/
Makefile
File metadata and controls
129 lines (104 loc) · 3.24 KB
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
default: pylint pytest
# - - - - - - - - - - - - - - - - - - - - - - - -
# Virtual env
create_env:
pyenv virtualenv ${VIRTUAL_ENV_PYTHON_VERSION} ${VIRTUAL_ENV_NAME}
list_env:
pyenv versions
show_project_env:
@echo ""
@echo "⚠️ In order to fill these, run \". ./make_project_env.sh\""
@echo "⚠️ Then in order to create env, run \"make create_env\""
@echo ""
@echo "Python version:"
@echo "- VIRTUAL_ENV_PYTHON_VERSION: ${VIRTUAL_ENV_PYTHON_VERSION}"
@echo "Virtual env:"
@echo "- VIRTUAL_ENV_NAME: ${VIRTUAL_ENV_NAME}"
# - - - - - - - - - - - - - - - - - - - - - - - -
# Packages
install_jupyter:
pip install jupyter
pip install jupyter_contrib_nbextensions
pip install jupyter_nbextensions_configurator
install_requirements:
pip install -r requirements.txt
install_project:
pip install -e .
# - - - - - - - - - - - - - - - - - - - - - - - -
# Project
pylint:
find . -iname "*.py" -not -path "./tests/*" | xargs pylint --output-format=colorized; true
pytest:
# $(file) allows to `make pytest file=test/conf`
PYTHONDONTWRITEBYTECODE=1 pytest -v --color=yes $(file)
run:
python -m project.app $(reg)
# - - - - - - - - - - - - - - - - - - - - - - - -
# ai platform training
show_gcp_creds:
cat ${GOOGLE_APPLICATION_CREDENTIALS}
show_aipf_env:
@echo ""
@echo "⚠️ In order to fill these, run \". ./make_gcp_env.sh\""
@echo ""
@echo "Code package:"
@echo "- PACKAGE_NAME: ${PACKAGE_NAME}"
@echo "- PACKAGE_ENTRY_POINT: ${PACKAGE_ENTRY_POINT}"
@echo ""
@echo "Training environment:"
@echo "- REGION: ${REGION}"
@echo "- PYTHON_VERSION: ${PYTHON_VERSION}"
@echo "- RUNTIME_VERSION: ${RUNTIME_VERSION}"
@echo ""
@echo "Training job:"
@echo "- JOB_PREFIX: ${JOB_PREFIX}"
@echo ""
@echo "Training storage:"
@echo "- BUCKET_NAME: ${BUCKET_NAME}"
@echo "- JOB_FOLDER: ${JOB_FOLDER}"
JOB_NAME=${JOB_PREFIX}_$(shell date +'%Y%m%d_%H%M%S')
gcp_submit_training:
gcloud ai-platform jobs submit training ${JOB_NAME} \
--job-dir "gs://${BUCKET_NAME}/${JOB_FOLDER}" \
--package-path ${PACKAGE_NAME} \
--module-name ${PACKAGE_NAME}.${PACKAGE_ENTRY_POINT} \
--region ${REGION} \
--python-version=${PYTHON_VERSION} \
--runtime-version=${RUNTIME_VERSION} \
--stream-logs
gcp_submit_registry:
gcloud ai-platform jobs submit training ${JOB_NAME} \
--job-dir "gs://${BUCKET_NAME}/${JOB_FOLDER}" \
--package-path ${PACKAGE_NAME} \
--module-name ${PACKAGE_NAME}.${PACKAGE_ENTRY_POINT} \
--region ${REGION} \
--python-version=${PYTHON_VERSION} \
--runtime-version=${RUNTIME_VERSION} \
--stream-logs \
-- \
--reg=True
# - - - - - - - - - - - - - - - - - - - - - - - -
# gcp prod prediction
set_zone:
gcloud config set compute/zone ${REGION}
show_prod_env:
@echo ""
@echo "⚠️ In order to fill these, run \". ./make_gcp_env.sh\""
@echo ""
@echo "Google Cloud Platform project:"
@echo "- PROJECT_ID: ${PROJECT_ID}"
@echo ""
@echo "Google Cloud Registry:"
@echo "- DOCKER_IMAGE_NAME: ${DOCKER_IMAGE_NAME}"
@echo ""
@echo "Google Kubernetes Engine:"
@echo "- CLUSTER_NAME: ${CLUSTER_NAME}"
@echo "- DEPLOYMENT_NAME: ${DEPLOYMENT_NAME}"
show_gcp_conf:
gcloud auth list
gcloud config list
gcloud iam service-accounts list
# - - - - - - - - - - - - - - - - - - - - - - - -
# api
run_api:
env FLASK_APP=api.flask flask run