uranusjr commented on code in PR #73118:
URL: https://github.com/apache/airflow/pull/73118#discussion_r4024278485


##########
shared/module_loading/src/airflow_shared/module_loading/dag_file.py:
##########
@@ -102,6 +125,10 @@ def might_contain_dag(
         )
 
     if might_contain_dag_callable is None:
-        might_contain_dag_callable = might_contain_dag_via_default_heuristic
+        return might_contain_dag_via_default_heuristic(file_path, 
zip_file=zip_file)
 
-    return might_contain_dag_callable(file_path=file_path, zip_file=zip_file)
+    if isinstance(file_path, (str, os.PathLike)):
+        return might_contain_dag_callable(file_path=file_path, 
zip_file=zip_file)
+    # Custom callables only accept (file_path, zip_file); let the definition 
materialize itself.
+    with file_path.as_file() as materialized:
+        return might_contain_dag_callable(file_path=str(materialized), 
zip_file=None)

Review Comment:
   I think the process should crash if the callable is faulty. The callable is 
supposed to be admin-approved (it’s a part of the installation’s 
configuration), not arbitrary user code, so an error should be reported very 
loudly, not caught.



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