uranusjr commented on code in PR #32811:
URL: https://github.com/apache/airflow/pull/32811#discussion_r1275700897
##########
docs/apache-airflow/howto/usage-cli.rst:
##########
@@ -374,3 +374,31 @@ JSON example output:
airflow_db={"conn_type": "mysql", "login": "root", "password":
"plainpassword", "host": "mysql", "schema": "airflow"}
druid_broker_default={"conn_type": "druid", "host": "druid-broker",
"port": 8082, "extra": "{\"endpoint\": \"druid/v2/sql\"}"}
+
+Testing for DAG Import Errors
+-----------------------------
+The CLI can be used to check whether any discovered DAGs have import errors
via the `dags` `list-import-errors` command. The output is predictable for
situations where there are no errors, such as `[]` for the json style output,
so it is possible to create an automation step which fails if any DAGs cannot
be imported. For instance, the check could be run in CI or pre-commit.
+
+Example command that fails if there are any errors:
+
+.. code-block:: bash
+
+ airflow dags list-import-errors | grep -q "No data found"
Review Comment:
I dislike a `grep` example too since it would produce false negatives if any
of the import errors contain the message *No data found*. It would be better if
it checks for the string exactly, but in general working with non-structured
data should not be recommended in the first place.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]