-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·61 lines (49 loc) · 2.62 KB
/
setup.sh
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
#!/bin/bash
echo "Installing example requirements (see requirements.txt)..."
{
pip install -r requirements.txt
zenml integration install huggingface pytorch azure kubernetes seldon -y
} >> setup_out.log
if [[ ! -f .matcha/infrastructure/matcha.state ]]
then
echo "Error: The file .matcha/infrastructure/matcha.state does not exist!"
echo "Ensure that you have run 'matcha provision' in this directory and all cloud resources have been provisioned."
exit 1
fi
function get_state_value() {
resource_name=$1
property=$2
json_string=$(matcha get "$resource_name" "$property" --output json --show-sensitive)
value=$(echo "$json_string" | sed -n 's/.*"'$property'": "\(.*\)".*/\1/p')
echo "$value"
}
zenml_storage_path=$(get_state_value pipeline storage-path)
zenml_connection_string=$(get_state_value pipeline connection-string)
k8s_context=$(get_state_value orchestrator k8s-context)
acr_registry_uri=$(get_state_value container-registry registry-url)
acr_registry_name=$(get_state_value container-registry registry-name)
zenserver_url=$(get_state_value pipeline server-url)
zenserver_username=$(get_state_value pipeline server-username)
zenserver_password=$(get_state_value pipeline server-password)
seldon_workload_namespace=$(get_state_value model-deployer workloads-namespace)
seldon_ingress_host=$(get_state_value model-deployer base-url)
echo "Setting up ZenML..."
{
export AUTO_OPEN_DASHBOARD=false
az acr login --name="$acr_registry_name"
zenml init
# Disconnect from previous server if exists to prevent errors when a new Zen server is being used
zenml disconnect
zenml connect --url="$zenserver_url" --username="$zenserver_username" --password="$zenserver_password" --no-verify-ssl
zenml secret create az_secret --connection_string="$zenml_connection_string"
zenml container-registry register acr_registry -f azure --uri="$acr_registry_uri"
zenml artifact-store register az_store -f azure --path="$zenml_storage_path" --authentication_secret=az_secret
zenml orchestrator register k8s_orchestrator -f kubernetes --kubernetes_context="$k8s_context" --kubernetes_namespace=zenml --synchronous=True
zenml image-builder register docker_builder --flavor=local
zenml model-deployer register seldon_deployer --flavor=seldon \
--kubernetes_context=$k8s_context \
--kubernetes_namespace=$seldon_workload_namespace \
--base_url=http://$seldon_ingress_host \
zenml stack register llm_example_cloud_stack -i docker_builder -c acr_registry -a az_store -o k8s_orchestrator --model_deployer=seldon_deployer --set
} >> setup_out.log
echo "ZenML set-up complete."