@@ -126,7 +126,7 @@ def post_progress(context, from_task=None):
126126 )
127127 }
128128 try :
129- http_hook .run (endpoint = ROUTES ["progress" ], json = message )
129+ http_hook .run (endpoint = ROUTES ["progress" ], json = message , extra_options = { "timeout" : 30 } )
130130 except AirflowNotFoundException as err :
131131 logging .debug (f"Failed to POST progress updates. Skipping \n { err } " )
132132 except Exception as err :
@@ -174,7 +174,7 @@ def post_results(context):
174174 )
175175 }
176176 try :
177- http_hook .run (endpoint = ROUTES ["results" ], json = message )
177+ http_hook .run (endpoint = ROUTES ["results" ], json = message , extra_options = { "timeout" : 30 } )
178178 except AirflowNotFoundException as err :
179179 logging .debug (f"Failed to POST results. Skipping \n { err } " )
180180 except Exception as err :
@@ -203,7 +203,7 @@ def post_status(context):
203203 )
204204 }
205205 try :
206- http_hook .run (endpoint = ROUTES ["status" ], json = message )
206+ http_hook .run (endpoint = ROUTES ["status" ], json = message , extra_options = { "timeout" : 30 } )
207207 except Exception as err :
208208 logging .debug (f"Failed to POST status updates. \n { err } " )
209209
@@ -213,18 +213,20 @@ def clean_up(context):
213213 Loads "cwl" arguments from the DAG, just in case updates them with
214214 all required defaults, and, unless "keep_tmp_data" was set to True,
215215 tries to remove all remporary data and related records in the XCom
216- table
216+ table. If this function is called from clean_dag_run or any other
217+ DAG that doesn't have "cwl" in the "default_args" we will catch
218+ KeyError exception
217219 """
218220 try :
219221 default_cwl_args = get_default_cwl_args (
220222 context ["dag" ].default_args ["cwl" ]
221223 )
222224 if not default_cwl_args ["keep_tmp_data" ]:
223225 dag_run = context ["dag_run" ]
224- remove_dag_run_tmp_data (dag_run )
226+ remove_dag_run_tmp_data (dag_run ) # safe to run as it has its own exception handling
225227 for ti in dag_run .get_task_instances ():
226228 ti .clear_xcom_data ()
227- except KeyError as err : # other than CWLDAG non of our DAGs should have "cwl" field in default_args
229+ except KeyError as err : # will catch if called from clean_dag_run
228230 logging .info (f"Failed to clean up data for current DAG, due to \n { err } " )
229231
230232
0 commit comments