You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/12/07 07:37:46 UTC

[airflow] branch main updated: Make invalid characters exception more readable (#28181)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new e3ae69e9a7 Make invalid characters exception more readable (#28181)
e3ae69e9a7 is described below

commit e3ae69e9a779f14ee70c5646d6e072bb2365e54f
Author: Tzu-ping Chung <ur...@gmail.com>
AuthorDate: Wed Dec 7 15:37:39 2022 +0800

    Make invalid characters exception more readable (#28181)
    
    The InvalidStatsNameException message when a stats name contains invalid
    characters currently includes the set of allow characters, which is
    quite long and of underterministic order (bein formatted from a set),
    making the message impossible to decipher for a human.
    
    This commit changes the message to describe what characters are allowed
    in a human-readable fashion instead.
---
 airflow/stats.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/airflow/stats.py b/airflow/stats.py
index a20d8cfa48..d452b60100 100644
--- a/airflow/stats.py
+++ b/airflow/stats.py
@@ -196,7 +196,8 @@ def stat_name_default_handler(stat_name, max_length=250) -> str:
         )
     if not all((c in ALLOWED_CHARACTERS) for c in stat_name):
         raise InvalidStatsNameException(
-            f"The stat name ({stat_name}) has to be composed with characters in {ALLOWED_CHARACTERS}."
+            f"The stat name ({stat_name}) has to be composed of ASCII "
+            f"alphabets, numbers, or the underscore, dot, or dash characters."
         )
     return stat_name