self = <Retrying object at 0x7f8b77f139e8 (stop=<tenacity.stop.stop_after_attempt object at 0x7f8b7ad70f28>, wait=<tenacity.w...0x7f8b780218c8>, before=<function before_nothing at 0x7f8b7808f0d0>, after=<function after_nothing at 0x7f8b780a5a60>)>
fn = <function RetryingProxyStorage.content_add_metadata at 0x7f8b780259d8>
args = (<swh.storage.retry.RetryingProxyStorage object at 0x7f89ac3b9358>, [Content(sha1=b'4\x972t\xcc\xefj\xb4\xdf\xaa\xf8e\...e\x199We'\xe4,\xfdv\xa9EZ$2\xfe\x7fVf\x95dW}\xd9<B\x80\xe7mf\x1d", length=3, status='visible', data=None, ctime=None)])
kwargs = {}, retry_state = <tenacity.RetryCallState object at 0x7f89adc1ac88>
do = <tenacity.DoAttempt object at 0x7f89ac3ad5c0>
def call(self, fn, *args, **kwargs):
self.begin(fn)
retry_state = RetryCallState(
retry_object=self, fn=fn, args=args, kwargs=kwargs)
while True:
do = self.iter(retry_state=retry_state)
if isinstance(do, DoAttempt):
try:
> result = fn(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/tenacity/__init__.py:412:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.retry.RetryingProxyStorage object at 0x7f89ac3b9358>
content = [Content(sha1=b'4\x972t\xcc\xefj\xb4\xdf\xaa\xf8e\x99y/\xa9\xc3\xfeF\x89', sha1_git=b'\xd8\x1c\xc0q\x0e\xb6\xcf\x9e\xf...fe\x199We'\xe4,\xfdv\xa9EZ$2\xfe\x7fVf\x95dW}\xd9<B\x80\xe7mf\x1d", length=3, status='visible', data=None, ctime=None)]
@swh_retry
def content_add_metadata(self, content: List[Content]) -> Dict:
> return self.storage.content_add_metadata(content)
.tox/py3/lib/python3.7/site-packages/swh/storage/retry.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.in_memory.InMemoryStorage object at 0x7f89adbfe358>
content = [Content(sha1=b'4\x972t\xcc\xefj\xb4\xdf\xaa\xf8e\x99y/\xa9\xc3\xfeF\x89', sha1_git=b'\xd8\x1c\xc0q\x0e\xb6\xcf\x9e\xf...fe\x199We'\xe4,\xfdv\xa9EZ$2\xfe\x7fVf\x95dW}\xd9<B\x80\xe7mf\x1d", length=3, status='visible', data=None, ctime=None)]
def content_add_metadata(self, content: List[Content]) -> Dict:
> return self._content_add(content, with_data=False)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.in_memory.InMemoryStorage object at 0x7f89adbfe358>
contents = [Content(sha1=b'4\x972t\xcc\xefj\xb4\xdf\xaa\xf8e\x99y/\xa9\xc3\xfeF\x89', sha1_git=b'\xd8\x1c\xc0q\x0e\xb6\xcf\x9e\xf...fe\x199We'\xe4,\xfdv\xa9EZ$2\xfe\x7fVf\x95dW}\xd9<B\x80\xe7mf\x1d", length=3, status='visible', data=None, ctime=None)]
with_data = False
def _content_add(self, contents: List[Content], with_data: bool) -> Dict:
# Filter-out content already in the database.
contents = [
c for c in contents if not self._cql_runner.content_get_from_pk(c.to_dict())
]
self.journal_writer.content_add(contents)
if with_data:
# First insert to the objstorage, if the endpoint is
# `content_add` (as opposed to `content_add_metadata`).
# TODO: this should probably be done in concurrently to inserting
# in index tables (but still before the main table; so an entry is
# only added to the main table after everything else was
# successfully inserted.
summary = self.objstorage.content_add(
c for c in contents if c.status != "absent"
)
content_add_bytes = summary["content:add:bytes"]
content_add = 0
for content in contents:
content_add += 1
# Check for sha1 or sha1_git collisions. This test is not atomic
# with the insertion, so it won't detect a collision if both
# contents are inserted at the same time, but it's good enough.
#
# The proper way to do it would probably be a BATCH, but this
# would be inefficient because of the number of partitions we
# need to affect (len(HASH_ALGORITHMS)+1, which is currently 5)
for algo in {"sha1", "sha1_git"}:
collisions = []
# Get tokens of 'content' rows with the same value for
# sha1/sha1_git
rows = self._content_get_from_hash(algo, content.get_hash(algo))
for row in rows:
if getattr(row, algo) != content.get_hash(algo):
# collision of token(partition key), ignore this
# row
continue
for algo in HASH_ALGORITHMS:
if getattr(row, algo) != content.get_hash(algo):
# This hash didn't match; discard the row.
collisions.append(
{algo: getattr(row, algo) for algo in HASH_ALGORITHMS}
)
if collisions:
collisions.append(content.hashes())
raise HashCollision(algo, content.get_hash(algo), collisions)
(token, insertion_finalizer) = self._cql_runner.content_add_prepare(
> ContentRow(**remove_keys(content.to_dict(), ("data",)))
)
E TypeError: __init__() missing 1 required positional argument: 'ctime'
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:158: TypeError
The above exception was the direct cause of the following exception:
swh_storage = <swh.storage.retry.RetryingProxyStorage object at 0x7f89ac3b9358>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f89adc1a0f0>
def test_retrying_proxy_storage_content_add_metadata(swh_storage, sample_data):
"""Standard content_add_metadata works as before
"""
sample_content = sample_data.content
content = attr.evolve(sample_content, data=None)
pk = content.sha1
content_metadata = swh_storage.content_get([pk])
assert content_metadata == [None]
> s = swh_storage.content_add_metadata([content])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_retry.py:123:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/tenacity/__init__.py:329: in wrapped_f
return self.call(f, *args, **kw)
.tox/py3/lib/python3.7/site-packages/tenacity/__init__.py:409: in call
do = self.iter(retry_state=retry_state)
.tox/py3/lib/python3.7/site-packages/tenacity/__init__.py:369: in iter
six.raise_from(retry_exc, fut.exception())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = None
from_value = TypeError("__init__() missing 1 required positional argument: 'ctime'")
> ???
E tenacity.RetryError: RetryError[<Future at 0x7f89ac3ade80 state=finished raised TypeError>]
<string>:3: RetryError
TEST RESULT
TEST RESULT
- Run At
- Aug 12 2020, 7:43 PM