ashb commented on code in PR #30713:
URL: https://github.com/apache/airflow/pull/30713#discussion_r1189713867


##########
airflow/providers/openlineage/utils/utils.py:
##########
@@ -395,3 +397,10 @@ def wrapper(*args, **kwargs):
             log.exception(e)
 
     return wrapper
+
+
+def is_source_enabled():

Review Comment:
   `from airflow.compat.functools import cache` and then 
   ```suggestion
   @cache
   def is_source_enabled():
   ```



##########
tests/providers/openlineage/extractors/test_bash_extractor.py:
##########


Review Comment:
   I don't see any tests that set the airflow config, just the "fallback" env. 
`@conf_vars` can help.



##########
airflow/providers/openlineage/utils/utils.py:
##########
@@ -395,3 +397,10 @@ def wrapper(*args, **kwargs):
             log.exception(e)
 
     return wrapper
+
+
+def is_source_enabled():
+    source_var = conf.get(
+        "openlinege", "disable_source_code", 
fallback=os.getenv("OPENLINEAGE_AIRFLOW_DISABLE_SOURCE_CODE")
+    )
+    return isinstance(source_var, str) and source_var.lower() not in ("true", 
"1", "t")

Review Comment:
   ```suggestion
       return conf.getboolean(
           "openlinege",
           "disable_source_code",
           fallback=os.getenv("OPENLINEAGE_AIRFLOW_DISABLE_SOURCE_CODE", 
"").lower() not in ("true", "1", "t")
       )
   ```



-- 
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]

Reply via email to