-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
91 lines (68 loc) · 3.58 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
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
GCLOUD_PROJECT:=$(shell gcloud config list --format 'value(core.project)' 2>/dev/null)
REGION="us-central1"
CLOUD_PROJECT:=$(shell gcloud config list --format 'value(core.project)' 2>/dev/null)
LATEST_IMAGE_URL=$(shell echo "gcr.io/${CLOUD_PROJECT}/collection:latest")
VERSION=$(shell sed -n 's/.*image:.*:\(.*\)/\1/p' run/collection/service.prod.yaml)
IMAGE_URL=$(shell echo "gcr.io/${CLOUD_PROJECT}/collection:${VERSION}")
install: ## Install dependencies
@echo "Installing dependencies..."
virtualenv -p python3 env
. env/bin/activate && pip install -e . && \
pip install -r requirements-test.txt && \
pip install -r optional-requirements.txt --use-deprecated=legacy-resolver
prod: ## Set the GCP project to prod
gcloud config set project langame-86ac4
dev: ## Set the GCP project to dev
gcloud config set project langame-dev
clean:
rm -rf env build **/wandb **/embeddings **/indexes *.egg-info **/index_infos.json **/__pycache__
# git add --all -- :!notebooks
release:
@VERSION=$$(cat setup.py | grep version | cut -d '"' -f 2); \
echo "Releasing version $$VERSION"; \
read -p "Commit content:" COMMIT; \
git add langame setup.py run Makefile .github .vscode scripts; \
echo "Committing '$$VERSION: $$COMMIT'"; \
git commit -m "$$VERSION: $$COMMIT"; \
git push origin main; \
git tag $$VERSION; \
git push origin $$VERSION
@echo "Done, check https://github.com/langa-me/langame-worker/actions"
self_chat:
#python3 scripts/self_chat.py generate_seeds
parlai self_chat --model-file zoo:seeker/seeker_dialogue_400M/model --task empathetic_dialogues --num-self-chats 200 --display-examples True --seed_messages_from_file="../langame-worker/seeds.txt" --outfile="./out" --rag-retriever-type search_engine
#--search_server http://localhost:8083
## Functions & run
run/collection/hosting:
cd run/collection; \
firebase use ${GCLOUD_PROJECT}; \
firebase deploy --only hosting
run/collection/build: ## [Local development] Build the docker image.
@echo "Building docker image for urls ${LATEST_IMAGE_URL} and ${IMAGE_URL}"
@docker buildx build ./run/collection --platform linux/amd64 -t ${LATEST_IMAGE_URL} -f ./run/collection/Dockerfile
@docker buildx build ./run/collection --platform linux/amd64 -t ${IMAGE_URL} -f ./run/collection/Dockerfile
run/collection/profile:
docker run --rm ${IMAGE_URL} dpkg-query -Wf '${Installed-Size}\t${Package}\t${Description}\n' | sort -n | tail -n10 | column -t -s $'\t'
run/collection/push: run/collection/build ## [Local development] Push the image to GCR.
docker push ${IMAGE_URL}
docker push ${LATEST_IMAGE_URL}
run/collection/deploy: run/collection/push ## [Local development] Build docker image, push and deploy to GCP.
@echo "Will deploy to ${REGION} on ${CLOUD_PROJECT}"
gcloud beta run services replace ./run/collection/service.prod.yaml --region ${REGION}
run/collection/policy:
gcloud run services set-iam-policy collection run/collection/policy.prod.yaml --region ${REGION}
run/collection/local:
# use .env.production env var into the python process
# . .env.production &&
@echo "Don't forget to run 'set -o allexport; source .env.production; set +o allexport'"
python3 run/collection/main.py
run/collection/bench:
python3 run/collection/bench.py
functions/slack_bot/deploy: ## [Local development] deploy to GCP.
cd functions/slack_bot; gcloud beta functions deploy slack_bot \
--runtime python39 \
--trigger-http \
--allow-unauthenticated
.PHONY: help
help: # Run `make help` to get help on the make commands
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'