Page MenuHomeSoftware Heritage
Paste P715

funny closed cursor is funny
ActivePublic

Authored by ardumont on Jul 3 2020, 5:35 PM.
swh_storage_backend_config["journal_writer"] = journal1
storage = get_storage(**swh_storage_backend_config)
# fill the storage and the journal (under prefix1)
for object_type, objects in TEST_OBJECTS.items():
method = getattr(storage, object_type + "_add")
> method(objects)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_backfill.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/metrics.py:24: in d
return f(*a, **kw)
.tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:62: in _meth
return meth(self, *args, db=db, cur=cur, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/storage/storage.py:825: in origin_visit_add
db.origin_visit_add_with_id(visit, cur=cur)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.db.Db object at 0x7fa86dfd4c50>, origin_visit = OriginVisit(origin='https://somewhere.org/den/fox', date=datetime.datetime(2013, 5, 7, 4, 20, 39, 369271, tzinfo=datetime.timezone.utc), type='git', visit=1)
cur = <cursor object at 0x7fa86dafa9f8; closed: -1>
def origin_visit_add_with_id(self, origin_visit: OriginVisit, cur=None) -> None:
"""Insert origin visit when id are already set
"""
ov = origin_visit
assert ov.visit is not None
cur = self._cursor(cur)
# doing an extra query like this is way simpler than trying to join
# the origin id in the query below
origin_id = next(self.origin_id_get_by_url([ov.origin], cur))
origin_visit_cols = ["origin", "visit", "date", "type"]
query = """INSERT INTO origin_visit ({cols}) VALUES ({values})
ON CONFLICT (origin, visit) DO NOTHING""".format(
cols=", ".join(origin_visit_cols),
values=", ".join("%s" for col in origin_visit_cols),
)
cur.execute(
> query, (origin_id, ov.visit, ov.date, ov.type),
)
E psycopg2.InterfaceError: cursor already closed
.tox/py3/lib/python3.7/site-packages/swh/storage/db.py:497: InterfaceError
=========================================================================================================== short test summary info ===========================================================================================================
FAILED .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_backfill.py::test_backfiller - psycopg2.InterfaceError: cursor already closed
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================================= 1 failed, 6 passed, 790 deselected in 5.27s =================================================================================================
ERROR: InvocationError for command /home/tony/work/inria/repo/swh/swh-environment/swh-storage/.tox/py3/bin/pytest --hypothesis-profile=fast --cov=/home/tony/work/inria/repo/swh/swh-environment/swh-storage/.tox/py3/lib/python3.7/site-packages/swh/storage .tox/py3/lib/python3.7/site-packages/swh/storage --doctest-modules --cov-branch --no-cov -x -s -m 'not cassandra' -k test_backfill (exited with code 1)
___________________________________________________________________________________________________________________ summary __________________________________________________________________________________________________________________