Skip to content

Commit 8e9e6dc

Browse files
committed
fix_sqlexception
1 parent 45cc685 commit 8e9e6dc

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

dags/common/quarantined_tests.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
import dataclasses
1818
import fnmatch
19+
import logging
20+
import os
1921
from typing import Set
2022

2123
from airflow.models import Variable
@@ -52,6 +54,20 @@ def match_quarantine_patterns(
5254
return False
5355

5456

57+
def safe_get_from_variable(key: str, default_var: str):
58+
"""
59+
Check if the current runtime is GitHub Actions. Ignoring getting variable in GitHub Actions to prevent from
60+
spamming logs.
61+
"""
62+
value = default_var
63+
is_CI = os.getenv("GITHUB_ACTIONS", "false").lower() == "true"
64+
if is_CI:
65+
logging.info("In GitHub Actions, skip getting variables")
66+
else:
67+
value = Variable.get(key, default_var=default_var)
68+
return value
69+
70+
5571
"""
5672
The quarantine list is defined by a set of UNIX Shell Glob Patterns.
5773
These patterns are used to match and quarantine tests.
@@ -63,7 +79,7 @@ def match_quarantine_patterns(
6379
- maxd-sdxl-* (Matches all 'maxd-sdxl-' tests)
6480
"""
6581
quarantine_patterns = parse_quarantine_patterns(
66-
Variable.get("quarantine_patterns", "")
82+
safe_get_from_variable("quarantine_patterns", "")
6783
)
6884

6985

0 commit comments

Comments
 (0)