Skip to content

Commit

Permalink
Use more meaningfull message for DagBag timeouts (apache#11235)
Browse files Browse the repository at this point in the history
Instead of 'Timeout, PID: 1234' we can use something more meaningful
that will help users understand the logs.
  • Loading branch information
turbaszek authored Oct 2, 2020
1 parent e37dfc8 commit 0382f77
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion airflow/models/dagbag.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ def _load_modules_from_file(self, filepath, safe_mode):
if mod_name in sys.modules:
del sys.modules[mod_name]

with timeout(self.DAGBAG_IMPORT_TIMEOUT):
timeout_msg = f"DagBag import timeout for {filepath} after {self.DAGBAG_IMPORT_TIMEOUT}s"
with timeout(self.DAGBAG_IMPORT_TIMEOUT, error_message=timeout_msg):
try:
loader = importlib.machinery.SourceFileLoader(mod_name, filepath)
spec = importlib.util.spec_from_loader(mod_name, loader)
Expand Down

0 comments on commit 0382f77

Please sign in to comment.