@@ -121,7 +121,7 @@ def _read(self, ti, try_number, metadata=None):
121
121
except (AirflowConfigException , ValueError ):
122
122
pass
123
123
124
- response = requests . get (url , timeout = timeout )
124
+ response , log = self . _try_both_log_locations (url , timeout , log )
125
125
126
126
# Check if the resource was properly fetched
127
127
response .raise_for_status ()
@@ -205,3 +205,29 @@ def _init_file(self, ti):
205
205
os .chmod (full_path , 0o666 )
206
206
207
207
return full_path
208
+
209
+ def _try_both_log_locations (self , url , timeout , log ):
210
+ """If a logfile cannot be found, try the timezone naive url format."""
211
+ response = requests .get (url , timeout = timeout )
212
+
213
+ try :
214
+ response .raise_for_status ()
215
+ except requests .HTTPError as _ :
216
+ log += "*** (clover patch) Cannot find log at filename {url}\n " .format (url = url )
217
+ old_url = self ._convert_to_old_url (url )
218
+ try :
219
+ response = requests .get (old_url , timeout = timeout )
220
+ response .raise_for_status ()
221
+ except requests .HTTPError as _ :
222
+ log += "*** (clover patch) Cannot find log at filename {old_url}\n " .format (old_url = old_url )
223
+
224
+ return response , log
225
+
226
+ @staticmethod
227
+ def _convert_to_old_url (url ):
228
+ """Convert a logfile url from timezone aware to timezone naive.
229
+
230
+ ..NOTE ::
231
+ This assumes that all timestamps involved are UTC.
232
+ """
233
+ return url .replace ('+00:00' , '' )
0 commit comments