Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/loader.py
Show First 20 Lines • Show All 360 Lines • ▼ Show 20 Lines | def load(self) -> Dict: | ||||
if snapshot_id: | if snapshot_id: | ||||
result["snapshot_id"] = hash_to_hex(snapshot_id) | result["snapshot_id"] = hash_to_hex(snapshot_id) | ||||
return result | return result | ||||
# Prepare origin and origin_visit | # Prepare origin and origin_visit | ||||
origin = Origin(url=self.url) | origin = Origin(url=self.url) | ||||
try: | try: | ||||
self.storage.origin_add([origin]) | self.storage.origin_add([origin]) | ||||
visit = self.storage.origin_visit_add( | visit = list( | ||||
self.storage.origin_visit_add( | |||||
[ | [ | ||||
OriginVisit( | OriginVisit( | ||||
origin=self.url, date=self.visit_date, type=self.visit_type, | origin=self.url, date=self.visit_date, type=self.visit_type, | ||||
) | ) | ||||
] | ] | ||||
) | |||||
)[0] | )[0] | ||||
except Exception as e: | except Exception as e: | ||||
logger.exception("Failed to initialize origin_visit for %s", self.url) | logger.exception("Failed to initialize origin_visit for %s", self.url) | ||||
sentry_sdk.capture_exception(e) | sentry_sdk.capture_exception(e) | ||||
return {"status": "failed"} | return {"status": "failed"} | ||||
try: | try: | ||||
last_snapshot = self.last_snapshot() | last_snapshot = self.last_snapshot() | ||||
▲ Show 20 Lines • Show All 317 Lines • Show Last 20 Lines |