Skip to content

Commit 3ba3a62

Browse files
Update demos/airflow-scheduled-job/03-enable-and-run-spark-dag.yaml
Co-authored-by: Nick <[email protected]>
1 parent 0720971 commit 3ba3a62

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

demos/airflow-scheduled-job/03-enable-and-run-spark-dag.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ spec:
1313
# restarted. Additionally, the db-init job takes a few minutes to complete before the cluster is deployed. The wait/watch steps
1414
# below are not "water-tight" but add a layer of stability by at least ensuring that the db is initialized and ready and that
1515
# all pods are reachable (albeit independent of each other).
16-
command: [
17-
"bash",
18-
"-c",
19-
'
16+
command:
17+
- bash
18+
- -euo
19+
- pipefail
20+
- -c
21+
- |
2022
kubectl rollout status --watch statefulset/airflow-webserver-default
21-
&& kubectl rollout status --watch statefulset/airflow-scheduler-default
22-
&& export AIRFLOW_ADMIN_PASSWORD=$(cat /airflow-credentials/adminUser.password)
23-
&& export ACCESS_TOKEN=$(curl -XPOST http://airflow-webserver-default-headless:8080/auth/token -H ''Content-Type: application/json'' -d ''{"username": "admin", "password": "''$AIRFLOW_ADMIN_PASSWORD''"}'' | jq ''.access_token'' | tr -d ''"'')
24-
&& curl -H "Authorization: Bearer $ACCESS_TOKEN" -H ''Content-Type: application/json'' -XPATCH http://airflow-webserver-default-headless:8080/api/v2/dags/sparkapp_dag -d ''{"is_paused": false}'' | jq
25-
&& curl -H "Authorization: Bearer $ACCESS_TOKEN" -H ''Content-Type: application/json'' -XPOST http://airflow-webserver-default-headless:8080/api/v2/dags/sparkapp_dag/dagRuns -d ''{"logical_date": null}'' | jq
26-
',
27-
]
23+
kubectl rollout status --watch statefulset/airflow-scheduler-default
24+
AIRFLOW_ADMIN_PASSWORD=$(cat /airflow-credentials/adminUser.password)
25+
ACCESS_TOKEN=$(curl -XPOST http://airflow-webserver-default-headless:8080/auth/token -H 'Content-Type: application/json' -d '{"username": "admin", "password": "'$AIRFLOW_ADMIN_PASSWORD'"}' | jq -r .access_token)
26+
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' -XPATCH http://airflow-webserver-default-headless:8080/api/v2/dags/sparkapp_dag -d '{"is_paused": false}' | jq
27+
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' -XPOST http://airflow-webserver-default-headless:8080/api/v2/dags/sparkapp_dag/dagRuns -d '{"logical_date": null}' | jq
2828
volumeMounts:
2929
- name: airflow-credentials
3030
mountPath: /airflow-credentials

0 commit comments

Comments
 (0)