Page MenuHomeSoftware Heritage

D2828.id10066.diff
No OneTemporary

D2828.id10066.diff

diff --git a/requirements-swh.txt b/requirements-swh.txt
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -1,4 +1,4 @@
swh.core >= 0.0.75
swh.model >= 0.0.60
swh.scheduler
-swh.storage >= 0.0.163
+swh.storage >= 0.0.178
diff --git a/swh/loader/core/loader.py b/swh/loader/core/loader.py
--- a/swh/loader/core/loader.py
+++ b/swh/loader/core/loader.py
@@ -160,8 +160,7 @@
pass
def _store_origin_visit(self) -> None:
- """Store origin and visit references. Sets the self.origin_visit and
- self.visit references.
+ """Store origin and visit references. Sets the self.visit references.
"""
assert self.origin
@@ -169,9 +168,8 @@
if not self.visit_date: # now as default visit_date if not provided
self.visit_date = datetime.datetime.now(tz=datetime.timezone.utc)
- self.origin_visit = self.storage.origin_visit_add(
+ self.visit = self.storage.origin_visit_add(
self.origin.url, self.visit_date, self.visit_type)
- self.visit = self.origin_visit['visit']
@abstractmethod
def prepare(self, *args, **kwargs) -> None:
@@ -303,7 +301,7 @@
self.store_metadata()
self.storage.origin_visit_update(
- self.origin.url, self.visit, self.visit_status()
+ self.origin.url, self.visit.visit, self.visit_status()
)
self.post_load()
except Exception:
@@ -313,7 +311,7 @@
'swh_task_kwargs': kwargs,
})
self.storage.origin_visit_update(
- self.origin.url, self.visit, 'partial'
+ self.origin.url, self.visit.visit, 'partial'
)
self.post_load(success=False)
return {'status': 'failed'}
@@ -407,5 +405,5 @@
snapshot = self.get_snapshot()
self.storage.snapshot_add([snapshot])
self.storage.origin_visit_update(
- self.origin.url, self.visit, snapshot=snapshot.id)
+ self.origin.url, self.visit.visit, snapshot=snapshot.id)
self.flush()
diff --git a/swh/loader/core/tests/test_loader.py b/swh/loader/core/tests/test_loader.py
--- a/swh/loader/core/tests/test_loader.py
+++ b/swh/loader/core/tests/test_loader.py
@@ -32,8 +32,9 @@
self.origin_url = origin.url
self.visit_date = datetime.datetime.utcnow()
self.visit_type = 'git'
- self.storage.origin_visit_add(self.origin_url, self.visit_date,
- self.visit_type)
+ origin_url = self.storage.origin_add_one(origin)
+ self.visit = self.storage.origin_visit_add(
+ origin_url, self.visit_date, self.visit_type)
class DummyDVCSLoader(DummyLoader, DVCSLoader):
diff --git a/swh/loader/package/loader.py b/swh/loader/package/loader.py
--- a/swh/loader/package/loader.py
+++ b/swh/loader/package/loader.py
@@ -261,10 +261,8 @@
origin = Origin(url=self.url)
try:
self.storage.origin_add_one(origin)
- visit_id = self.storage.origin_visit_add(
- origin=self.url,
- date=self.visit_date,
- type=self.visit_type)['visit']
+ visit = self.storage.origin_visit_add(
+ self.url, date=self.visit_date, type=self.visit_type)
except Exception:
logger.exception('Failed to create origin/origin_visit:')
return {'status': 'failed'}
@@ -338,7 +336,7 @@
status_load = 'failed'
finally:
self.storage.origin_visit_update(
- origin=self.url, visit_id=visit_id, status=status_visit,
+ origin=self.url, visit_id=visit.visit, status=status_visit,
snapshot=snapshot and snapshot.id)
result = {
'status': status_load,

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 1:50 PM (8 h, 29 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220958

Event Timeline