Skip to content

Commit

Permalink
fix(getting started): use lightweight DAG to avoid OOM issues (#401)
Browse files Browse the repository at this point in the history
* fix(getting started): use lightweight DAG to avoid OOM issues

* Successfully ran the getting started script

* Update the jinja template for the script too
  • Loading branch information
razvan authored Mar 6, 2024
1 parent 5b658c8 commit d55a6c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Use new label builders ([#366]).
- Use new ldap::AuthenticationClassProvider `endpoint_url()` method ([#366]).
- Support git-sync `4.2.1` ([#387]).
- Use a lightweight DAG for the getting started guide to avoid OOM issues ([#401])

### Fixed

Expand All @@ -35,6 +36,7 @@
[#374]: https://github.com/stackabletech/airflow-operator/pull/374
[#381]: https://github.com/stackabletech/airflow-operator/pull/381
[#387]: https://github.com/stackabletech/airflow-operator/pull/387
[#401]: https://github.com/stackabletech/airflow-operator/pull/401

## [23.11.0] - 2023-11-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fi
enable_dag() {
# tag::enable-dag[]
curl -s --user airflow:airflow -H 'Content-Type:application/json' \
-XPATCH http://localhost:8080/api/v1/dags/example_complex \
-XPATCH http://localhost:8080/api/v1/dags/example_trigger_target_dag \
-d '{"is_paused": false}'
# end::enable-dag[]
}
Expand All @@ -129,7 +129,7 @@ enable_dag
run_dag() {
# tag::run-dag[]
curl -s --user airflow:airflow -H 'Content-Type:application/json' \
-XPOST http://localhost:8080/api/v1/dags/example_complex/dagRuns \
-XPOST http://localhost:8080/api/v1/dags/example_trigger_target_dag/dagRuns \
-d '{}' | jq -r '.dag_run_id'
# end::run-dag[]
}
Expand All @@ -139,7 +139,7 @@ dag_id=$(run_dag)
request_dag_status() {
# tag::check-dag[]
curl -s --user airflow:airflow -H 'Content-Type:application/json' \
-XGET http://localhost:8080/api/v1/dags/example_complex/dagRuns/"$dag_id" | jq -r '.state'
-XGET http://localhost:8080/api/v1/dags/example_trigger_target_dag/dagRuns/"$dag_id" | jq -r '.state'
# end::check-dag[]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fi
enable_dag() {
# tag::enable-dag[]
curl -s --user airflow:airflow -H 'Content-Type:application/json' \
-XPATCH http://localhost:8080/api/v1/dags/example_complex \
-XPATCH http://localhost:8080/api/v1/dags/example_trigger_target_dag \
-d '{"is_paused": false}'
# end::enable-dag[]
}
Expand All @@ -129,7 +129,7 @@ enable_dag
run_dag() {
# tag::run-dag[]
curl -s --user airflow:airflow -H 'Content-Type:application/json' \
-XPOST http://localhost:8080/api/v1/dags/example_complex/dagRuns \
-XPOST http://localhost:8080/api/v1/dags/example_trigger_target_dag/dagRuns \
-d '{}' | jq -r '.dag_run_id'
# end::run-dag[]
}
Expand All @@ -139,7 +139,7 @@ dag_id=$(run_dag)
request_dag_status() {
# tag::check-dag[]
curl -s --user airflow:airflow -H 'Content-Type:application/json' \
-XGET http://localhost:8080/api/v1/dags/example_complex/dagRuns/"$dag_id" | jq -r '.state'
-XGET http://localhost:8080/api/v1/dags/example_trigger_target_dag/dagRuns/"$dag_id" | jq -r '.state'
# end::check-dag[]
}

Expand Down
6 changes: 3 additions & 3 deletions docs/modules/airflow/pages/getting_started/first_steps.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Since the examples were loaded in the cluster definition, they will appear under

image::getting_started/airflow_dags.png[Example Airflow DAGs]

Select one of these DAGs by clicking on the name in the left-hand column e.g. `example_complex`. Click on the arrow in the top right of the screen, select "Trigger DAG" and the DAG nodes will be automatically highlighted as the job works through its phases.
Select one of these DAGs by clicking on the name in the left-hand column e.g. `example_trigger_target_dag`. Click on the arrow in the top right of the screen, select "Trigger DAG" and the DAG nodes will be automatically highlighted as the job works through its phases.

image::getting_started/airflow_running.png[Airflow DAG in action]

Expand All @@ -112,11 +112,11 @@ Great! You have set up an Airflow cluster, connected to it and run your first DA
.Alternative: Using the command line
[%collapsible]
====
If you prefer to interact directly with the API instead of using the web interface, you can use the following commands. The DAG is one of the example DAGs named `example_complex`. To trigger a DAG run via the API requires an initial extra step to ensure that the DAG is not in a paused state:
If you prefer to interact directly with the API instead of using the web interface, you can use the following commands. The DAG is one of the example DAGs named `example_trigger_target_dag`. To trigger a DAG run via the API requires an initial extra step to ensure that the DAG is not in a paused state:
[source,bash]
include::example$getting_started/code/getting_started.sh[tag=enable-dag]
A DAG can then be triggered by providing the DAG name (in this case, `example_complex`). The response identifies the DAG identifier, which we can parse out of the JSON like this:
A DAG can then be triggered by providing the DAG name (in this case, `example_trigger_target_dag`). The response identifies the DAG identifier, which we can parse out of the JSON like this:
[source,bash]
include::example$getting_started/code/getting_started.sh[tag=run-dag]
Expand Down

0 comments on commit d55a6c0

Please sign in to comment.