You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/03/06 13:13:00 UTC

[GitHub] [airflow] ashb commented on a change in pull request #4828: [AIRFLOW-4002] Optionally open debugger on errors in airflow test.

ashb commented on a change in pull request #4828: [AIRFLOW-4002] Optionally open debugger on errors in airflow test.
URL: https://github.com/apache/airflow/pull/4828#discussion_r262933975
 
 

 ##########
 File path: airflow/bin/cli.py
 ##########
 @@ -686,10 +687,20 @@ def test(args, dag=None):
         task.params.update(passed_in_params)
     ti = TaskInstance(task, args.execution_date)
 
-    if args.dry_run:
-        ti.dry_run()
-    else:
-        ti.run(ignore_task_deps=True, ignore_ti_state=True, test_mode=True)
+    try:
+        if args.dry_run:
+            ti.dry_run()
+        else:
+            ti.run(ignore_task_deps=True, ignore_ti_state=True, test_mode=True)
+    except Exception:
+        if args.post_mortem:
+            try:
+                debugger = importlib.import_module("ipdb")
+            except ImportError:
+                debugger = importlib.import_module("pdb")
+            debugger.post_mortem()
 
 Review comment:
   Oh nice, I didn't know about this function. (I've always just used `.set_trace()`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services