Skip to content

more specific error handling in undefined jinja variables rule#13549

Closed
lperson wants to merge 3 commits intoapache:v1-10-stablefrom
lperson:improve_exception_handling_in_undefined_jinja_variables
Closed

more specific error handling in undefined jinja variables rule#13549
lperson wants to merge 3 commits intoapache:v1-10-stablefrom
lperson:improve_exception_handling_in_undefined_jinja_variables

Conversation

@lperson
Copy link

@lperson lperson commented Jan 7, 2021

  1. Use regex to extract variable name from exception message
  2. Specific handling for ValueError and TypeError
  3. Defend against endless loop

@boring-cyborg
Copy link

boring-cyborg bot commented Jan 7, 2021

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, pylint and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@mik-laj
Copy link
Member

mik-laj commented Jan 7, 2021

Caan you add tests to avoid regression?

@lperson lperson force-pushed the improve_exception_handling_in_undefined_jinja_variables branch from 1e57476 to 121fbd5 Compare January 9, 2021 03:06
@kaxil kaxil force-pushed the improve_exception_handling_in_undefined_jinja_variables branch from c895fc4 to a08cfba Compare January 22, 2021 21:59
"Task: templated_string, Attribute: env, Error: no such element: dict object['element']",
"Possible UndefinedJinjaVariable -> DAG: test-undefined-jinja-variables, "
"Task: miscellaneous_exception, Attribute: bash_command, "
"Error: 'NoneType' object is not iterable",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Error: 'NoneType' object is not iterable",
"Error: 'NoneType' object is not iterable, "

@kaxil
Copy link
Member

kaxil commented Feb 17, 2021

We removed this check in 1.2.0 of upgrade-check

@kaxil kaxil closed this Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants