-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart-cluster
More file actions
executable file
·28 lines (21 loc) · 1.08 KB
/
start-cluster
File metadata and controls
executable file
·28 lines (21 loc) · 1.08 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
#!/bin/sh
#Pegar o id do cluster a ser iniciado
cluster_id="$(grep -E -o '\w{4}-\w{6}-\w{8}' $HOME/.databricks-connect)"
#inicia o cluster
databricks clusters start --cluster-id $cluster_id
# Armazena o status do cluster
status_cluster=$(databricks clusters list | grep "$cluster_id" | grep -Eo 'TERMINATED|RUNNING|PENDING')
# Notifica o status atual do cluster (Esperado que está PENDING)
notification_id=$(notify-send --print-id "Databricks" "Cluster: $status_cluster")
until [ "$status_cluster" = "RUNNING" ]
do
echo "$status_cluster"
# Fica atualizando a notificação do status do cluster
notification_id=$(notify-send --print-id --replace-id="$notification_id" "Databricks" "Cluster: $status_cluster")
sleep 1
status_cluster=$(databricks clusters list | grep "$cluster_id" | grep -Eo 'TERMINATED|RUNNING|PENDING')
done
# Notifica que o cluster foi inciado
notification_id=$(notify-send --print-id --urgency='critical' --replace-id="$notification_id" "Databricks" "Cluster: $status_cluster")
# Inicia o ipython fazendo a configuração básica
# ipython -i databricks-ipython.py