Commit b7fe726
authored
Add validation for pool names to prevent InvalidStatsNameException (#59938)
* Add Validation for pool names to prevent InvalidStatsNameException Pool names can now only contain ASCII alphabets, numbers , underscores,dots,and dashes to ensure compatibility with stats naming requirments. fixes #59935
* Add unit Tests and news fragment for pool name validation
* Fix test file with proper database session handling
* Fix test assertions to use pytest.raises match parameter
* Add newline at the end of pool.py file
* Fix trailing whitespace and quote style in pool.py
* Fix syntax error: use consistent double quotes in regex
* Add missing newline and __init__.py file
* Add missing newline and __init__.py with license
* Fix __init__.py with proper license and single newline
* Implement pool name normalization for stats reporting
Following @potiuk's feedback, changed approach from preventing invalid
pool names to normalizing them for stats reporting.
Changes:
- Replaced validate_pool_name() with normalize_pool_name_for_stats()
- Pool names with invalid characters are normalized (replaced with _)
when emitting metrics
- Logs warning when normalization occurs, suggesting pool rename
- Removed validation from create_or_update_pool()
- Updated scheduler_job_runner.py to use normalized names for stats
- Removed validation tests
- Updated news fragment
This prevents InvalidStatsNameException without breaking existing pools
with invalid names.
Fixes #59935
* Implement pool name normalization for stats reporting
Following @potiuk's feedback, changed approach from preventing invalid
pool names to normalizing them for stats reporting.
Changes:
- Added normalize_pool_name_for_stats() function in pool.py
- Pool names with invalid characters are normalized (replaced with _)
when emitting metrics in scheduler_job_runner.py
- Logs warning when normalization occurs
- Removed validation tests
- Removed accidental fix_quote.py file
- Updated news fragment
This prevents InvalidStatsNameException without breaking existing pools.
Fixes #59935
* Add missing 're' module import
* Remove duplicate import
* Apply CI formatting fixes - import order and blank lines
* Fix formatting - add proper blank lines per ruff format requirements1 parent 82f01bf commit b7fe726
File tree
5 files changed
+80
-10
lines changed- airflow-core/src/airflow
- jobs
- models
- newsfragments
- tests/models
5 files changed
+80
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
2534 | 2535 | | |
2535 | 2536 | | |
2536 | 2537 | | |
2537 | | - | |
2538 | | - | |
2539 | | - | |
2540 | | - | |
2541 | | - | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
2542 | 2544 | | |
2543 | 2545 | | |
2544 | 2546 | | |
| |||
2550 | 2552 | | |
2551 | 2553 | | |
2552 | 2554 | | |
2553 | | - | |
2554 | | - | |
2555 | | - | |
2556 | | - | |
2557 | | - | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
2558 | 2560 | | |
2559 | 2561 | | |
2560 | 2562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
38 | 71 | | |
39 | 72 | | |
40 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments