Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/loader.py
Show All 19 Lines | from typing import ( | ||||
Sequence, | Sequence, | ||||
Tuple, | Tuple, | ||||
TypeVar, | TypeVar, | ||||
) | ) | ||||
import attr | import attr | ||||
import sentry_sdk | import sentry_sdk | ||||
from itertools import islice | |||||
from swh.core.tarball import uncompress | from swh.core.tarball import uncompress | ||||
from swh.core.config import SWHConfig | from swh.core.config import SWHConfig | ||||
from swh.model import from_disk | from swh.model import from_disk | ||||
from swh.model.collections import ImmutableDict | from swh.model.collections import ImmutableDict | ||||
from swh.model.hashutil import hash_to_hex | from swh.model.hashutil import hash_to_hex | ||||
from swh.model.model import ( | from swh.model.model import ( | ||||
BaseModel, | BaseModel, | ||||
Sha1Git, | Sha1Git, | ||||
▲ Show 20 Lines • Show All 321 Lines • ▼ Show 20 Lines | def load(self) -> Dict: | ||||
) | ) | ||||
self.storage.origin_visit_status_add([visit_status]) | self.storage.origin_visit_status_add([visit_status]) | ||||
result: Dict[str, Any] = { | result: Dict[str, Any] = { | ||||
"status": status_load, | "status": status_load, | ||||
} | } | ||||
if snapshot_id: | if snapshot_id: | ||||
result["snapshot_id"] = hash_to_hex(snapshot_id) | result["snapshot_id"] = hash_to_hex(snapshot_id) | ||||
if failed_branches: | if failed_branches: | ||||
logger.warning( | logger.warning("%d failed branches", len(failed_branches)) | ||||
"%d failed branches: %s", len(failed_branches), failed_branches, | for i, urls in enumerate(islice(failed_branches, 50)): | ||||
vlorentz: 500 is a lot... | |||||
Done Inline Actionsyeah, but it seems to complain around 1000 ;) ardumont: yeah, but it seems to complain around 1000 ;)
whatdayasay? split in half 250? | |||||
Not Done Inline ActionsI don't know; 50 seems more reasonable, but whatever vlorentz: I don't know; 50 seems more reasonable, but whatever | |||||
) | prefix_url = "Failed branches: " if i == 0 else "" | ||||
logger.warning("%s%s", prefix_url, urls) | |||||
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 = list( | visit = list( | ||||
self.storage.origin_visit_add( | self.storage.origin_visit_add( | ||||
▲ Show 20 Lines • Show All 380 Lines • Show Last 20 Lines |
500 is a lot...