-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
168 lines (131 loc) · 4.49 KB
/
Makefile
File metadata and controls
168 lines (131 loc) · 4.49 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
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
install-tools:
@echo "Installing tools"
@echo "Installing tools"
chmod +x scripts/install_poetry.sh
chmod +x scripts/install_awscli.sh
chmod +x scripts/install_terraform.sh
@echo "Checking if Poetry is installed..."
@if ! command -v poetry &> /dev/null; then scripts/install_poetry.sh; fi
@echo "Checking if AWS CLI is installed..."
@if ! command -v aws &> /dev/null; then scripts/install_awscli.sh; fi
@echo "Checking if Terraform is installed..."
@if ! command -v terraform &> /dev/null; then scripts/install_terraform.sh; fi
setup:
@echo "Setting up virtual environment"
poetry shell
install:
@echo "Installing dependencies"
poetry install
format:
@echo "Formating code"
chmod +x ./format.sh
./format.sh
lint:
@echo "Liting code"
chmod +x ./lint.sh
./lint.sh
test:
@echo "Running tests"
poetry run python -m pytest -vv tests/*.py --cov=tests
run-app:
@echo "Running local app with uvicorn"
poetry run uvicorn src.app.main:app --host 127.0.0.1 --port 8000
predict:
@echo "Predicting with local app"
curl -X POST http://localhost:8000/predict -H "Content-Type: application/json" -d '{"predict":"10"}'
trigger-actions:
@echo "Triggering GitHub Actions"
git commit --amend --no-edit && git push --force-with-lease
lambda-predict:
@echo "Testing Lambda function"
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"10"}'
docker-build:
@echo "Building Docker container"
docker build -t app .
docker-run:
@echo "Starting Docker container"
docker run -d -p 8000:8000 app
mlflow-ui:
@echo "Starting MLflow UI"
mlflow ui
dvc-init:
@echo "Initializing DVC"
poetry run dvc init
dvc-add:
@echo "Adding data to DVC"
poetry run dvc add raw_dataset/dataset.csv
dvc-add-remote:
@echo "Adding remote storage to DVC. For cloud storage use: s3://mlflow-dvc-demo"
poetry run dvc remote add -d storage /tmp/dvc/localremote
dvc-push:
@echo "Pushing data to DVC remote storage"
poetry run dvc push
dvc-pull:
@echo "Pulling data from DVC remote storage"
poetry run dvc pull
dvc-metrics:
@echo "Showing DVC metrics"
poetry run dvc metrics show
dvc-plots:
@echo "Showing DVC plots"
poetry run dvc plots show predictions.csv
trigger-tuning:
@echo "Trigger DVC tuning"
git checkout -b hp_tune/$(shell git rev-parse --short HEAD)
git commit --amend --no-edit && git push --force-with-lease --set-upstream origin hp_tune/$(shell git rev-parse --short HEAD)
trigger-training:
@echo "Trigger DVC training"
git checkout -b train/$(shell git rev-parse --short HEAD)
git commit --amend --no-edit && git push --force-with-lease --set-upstream origin train/$(shell git rev-parse --short HEAD)
aws-user:
@echo "Check current AWS user signed in to AWS CLI"
aws sts get-caller-identity
aws-region:
@echo "Check current AWS region"
aws configure get region
lambda-info:
@echo "Info Lambda functions"
aws lambda list-functions --max-items 10
tf-init:
@echo "Initializing Terraform <Initialize the provider with plugin>"
chmod +x ./scripts/terraform_init.sh
./scripts/terraform_init.sh
tf-plan:
@echo "Planning Terraform <Preview of resources to be created>"
cd terraform/ && terraform plan -input=false
tf-outp:
@echo "Output Terraform <Output of resources to be created>"
cd terraform && terraform output
tf-destroy:
@echo "Destroying Terraform <Destroy infrastruture resources>"
cd terraform && terraform destroy -auto-approve
tf-fmt:
@echo "Formating Terraform <Auto-format Terraform code>"
cd terraform && terraform fmt -recursive
tf-val:
@echo "Validating Terraform <Validate Terraform code>"
cd terraform && terraform validate
tf-deploy:
@echo "Deploying Terraform <Deploy infrastruture resources>"
cd terraform && terraform fmt -recursive && terraform validate && terraform apply -auto-approve -input=false
tf-upload:
@echo "Uploading Terraform <Upload infrastruture resources>"
cd terraform && terraform init
chmod +x ./scripts/upload_state.sh
chmod +x ./scripts/terraform_migrate.sh
./scripts/upload_state.sh
./scripts/terraform_migrate.sh
tf-mgt:
@echo "Migrating Terraform <Migrate infrastructure resources>"
chmod +x ./scripts/terraform_migrate.sh
./scripts/terraform_migrate.sh
tf-refresh:
@echo "Refreshing Terraform <Refresh infrastruture resources>"
cd terraform && terraform refresh
tf-st-list:
@echo "List Terraform state <List infrastruture resources>"
cd terraform && terraform state list
json-fmt:
@echo "Formating JSON <Auto-format JSON code>"
jq . .data/example.json > temp.json && mv temp.json .data/example.json
all: install format lint