Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/core/loader.py
Show First 20 Lines • Show All 356 Lines • ▼ Show 20 Lines | def load(self) -> Dict[str, str]: | ||||
}, | }, | ||||
}, | }, | ||||
) | ) | ||||
total_time_fetch_data = 0.0 | total_time_fetch_data = 0.0 | ||||
total_time_store_data = 0.0 | total_time_store_data = 0.0 | ||||
try: | try: | ||||
# Initially not a success, will be True when actually one | |||||
success = False | |||||
with self.statsd_timed("prepare"): | with self.statsd_timed("prepare"): | ||||
self.prepare() | self.prepare() | ||||
while True: | while True: | ||||
t1 = time.monotonic() | t1 = time.monotonic() | ||||
more_data_to_fetch = self.fetch_data() | more_data_to_fetch = self.fetch_data() | ||||
t2 = time.monotonic() | t2 = time.monotonic() | ||||
total_time_fetch_data += t2 - t1 | total_time_fetch_data += t2 - t1 | ||||
Show All 17 Lines | def load(self) -> Dict[str, str]: | ||||
) | ) | ||||
self.storage.origin_visit_status_add([visit_status]) | self.storage.origin_visit_status_add([visit_status]) | ||||
success = True | success = True | ||||
with self.statsd_timed( | with self.statsd_timed( | ||||
"post_load", tags={"success": success, "status": status} | "post_load", tags={"success": success, "status": status} | ||||
): | ): | ||||
self.post_load() | self.post_load() | ||||
except Exception as e: | except Exception as e: | ||||
success = False | |||||
if isinstance(e, NotFound): | if isinstance(e, NotFound): | ||||
status = "not_found" | status = "not_found" | ||||
task_status = "uneventful" | task_status = "uneventful" | ||||
else: | else: | ||||
status = "partial" if self.loaded_snapshot_id else "failed" | status = "partial" if self.loaded_snapshot_id else "failed" | ||||
task_status = "failed" | task_status = "failed" | ||||
self.log.exception( | self.log.exception( | ||||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |