Page MenuHomeSoftware Heritage

D1116.diff
No OneTemporary

D1116.diff

diff --git a/requirements-swh.txt b/requirements-swh.txt
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -1,6 +1,5 @@
-swh.core >= 0.0.44
+swh.core >= 0.0.54
swh.journal >= 0.0.5
swh.model >= 0.0.27
swh.objstorage >= 0.0.17
swh.scheduler >= 0.0.39
-swh.storage >= 0.0.102
diff --git a/swh/archiver/db.py b/swh/archiver/db.py
--- a/swh/archiver/db.py
+++ b/swh/archiver/db.py
@@ -5,7 +5,8 @@
import datetime
-from swh.storage.db import BaseDb, cursor_to_bytes, stored_procedure
+from swh.core.db import BaseDb
+from swh.core.db.db_utils import stored_procedure
def utcnow():
@@ -25,7 +26,7 @@
"""
cur = self._cursor(cur)
cur.execute("SELECT * FROM archive")
- yield from cursor_to_bytes(cur)
+ yield from cur
def content_archive_get(self, content_id, cur=None):
""" Get the archival status of a content in a specific server.
@@ -101,7 +102,7 @@
cur = self._cursor(cur)
cur.execute(query, vars)
- for content_id, present in cursor_to_bytes(cur):
+ for content_id, present in cur:
yield (content_id, present, {})
def content_archive_get_unarchived_copies(
@@ -150,7 +151,7 @@
cur = self._cursor(cur)
cur.execute(query, vars)
- for content_id, present in cursor_to_bytes(cur):
+ for content_id, present in cur:
yield (content_id, present, {})
@stored_procedure('swh_mktemp_content_archive')
@@ -187,7 +188,7 @@
cur = self._cursor(cur)
cur.execute("select * from swh_content_archive_missing(%s)",
(backend_name,))
- yield from cursor_to_bytes(cur)
+ yield from cur
def content_archive_get_unknown(self, cur=None):
"""Retrieve unknown sha1 from archiver db.
@@ -195,7 +196,7 @@
"""
cur = self._cursor(cur)
cur.execute('select * from swh_content_archive_unknown()')
- yield from cursor_to_bytes(cur)
+ yield from cur
def content_archive_update(self, content_id, archive_id,
new_status=None, cur=None):
diff --git a/swh/archiver/storage.py b/swh/archiver/storage.py
--- a/swh/archiver/storage.py
+++ b/swh/archiver/storage.py
@@ -11,8 +11,7 @@
from .db import ArchiverDb
from swh.model import hashutil
-from swh.storage.common import db_transaction_generator, db_transaction
-from swh.storage.exc import StorageDBError
+from swh.core.db.common import db_transaction_generator, db_transaction
class ArchiverStorage():
@@ -25,13 +24,10 @@
db_conn: either a libpq connection string, or a psycopg2 connection
"""
- try:
- if isinstance(dbconn, psycopg2.extensions.connection):
- self._db = ArchiverDb(dbconn)
- else:
- self._db = ArchiverDb.connect(dbconn)
- except psycopg2.OperationalError as e:
- raise StorageDBError(e)
+ if isinstance(dbconn, psycopg2.extensions.connection):
+ self._db = ArchiverDb(dbconn)
+ else:
+ self._db = ArchiverDb.connect(dbconn)
def get_db(self):
return self._db

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 3, 3:02 PM (5 d, 2 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3223030

Event Timeline