projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
15680: Pass arv-put --retries arg to Collection and BlockManager.
[arvados.git]
/
sdk
/
python
/
arvados
/
collection.py
diff --git
a/sdk/python/arvados/collection.py
b/sdk/python/arvados/collection.py
index 7ad07cc607206fe32f46fe0c94cf9ea34e115224..26902931582244142054d69bc2e52fe596927de3 100644
(file)
--- a/
sdk/python/arvados/collection.py
+++ b/
sdk/python/arvados/collection.py
@@
-283,7
+283,7
@@
class CollectionWriter(CollectionBase):
streampath, filename = split(streampath)
if self._last_open and not self._last_open.closed:
raise errors.AssertionError(
streampath, filename = split(streampath)
if self._last_open and not self._last_open.closed:
raise errors.AssertionError(
- "can't open '{}' when '{}' is still open".format(
+
u
"can't open '{}' when '{}' is still open".format(
filename, self._last_open.name))
if streampath != self.current_stream_name():
self.start_new_stream(streampath)
filename, self._last_open.name))
if streampath != self.current_stream_name():
self.start_new_stream(streampath)
@@
-461,22
+461,22
@@
class ResumableCollectionWriter(CollectionWriter):
writer._queued_file.seek(pos)
except IOError as error:
raise errors.StaleWriterStateError(
writer._queued_file.seek(pos)
except IOError as error:
raise errors.StaleWriterStateError(
- "failed to reopen active file {}: {}".format(path, error))
+
u
"failed to reopen active file {}: {}".format(path, error))
return writer
def check_dependencies(self):
for path, orig_stat in listitems(self._dependencies):
if not S_ISREG(orig_stat[ST_MODE]):
return writer
def check_dependencies(self):
for path, orig_stat in listitems(self._dependencies):
if not S_ISREG(orig_stat[ST_MODE]):
- raise errors.StaleWriterStateError("{} not file".format(path))
+ raise errors.StaleWriterStateError(
u
"{} not file".format(path))
try:
now_stat = tuple(os.stat(path))
except OSError as error:
raise errors.StaleWriterStateError(
try:
now_stat = tuple(os.stat(path))
except OSError as error:
raise errors.StaleWriterStateError(
- "failed to stat {}: {}".format(path, error))
+
u
"failed to stat {}: {}".format(path, error))
if ((not S_ISREG(now_stat[ST_MODE])) or
(orig_stat[ST_MTIME] != now_stat[ST_MTIME]) or
(orig_stat[ST_SIZE] != now_stat[ST_SIZE])):
if ((not S_ISREG(now_stat[ST_MODE])) or
(orig_stat[ST_MTIME] != now_stat[ST_MTIME]) or
(orig_stat[ST_SIZE] != now_stat[ST_SIZE])):
- raise errors.StaleWriterStateError("{} changed".format(path))
+ raise errors.StaleWriterStateError(
u
"{} changed".format(path))
def dump_state(self, copy_func=lambda x: x):
state = {attr: copy_func(getattr(self, attr))
def dump_state(self, copy_func=lambda x: x):
state = {attr: copy_func(getattr(self, attr))
@@
-492,7
+492,7
@@
class ResumableCollectionWriter(CollectionWriter):
try:
src_path = os.path.realpath(source)
except Exception:
try:
src_path = os.path.realpath(source)
except Exception:
- raise errors.AssertionError("{} not a file path".format(source))
+ raise errors.AssertionError(
u
"{} not a file path".format(source))
try:
path_stat = os.stat(src_path)
except OSError as stat_error:
try:
path_stat = os.stat(src_path)
except OSError as stat_error:
@@
-505,10
+505,10
@@
class ResumableCollectionWriter(CollectionWriter):
self._dependencies[source] = tuple(fd_stat)
elif path_stat is None:
raise errors.AssertionError(
self._dependencies[source] = tuple(fd_stat)
elif path_stat is None:
raise errors.AssertionError(
- "could not stat {}: {}".format(source, stat_error))
+
u
"could not stat {}: {}".format(source, stat_error))
elif path_stat.st_ino != fd_stat.st_ino:
raise errors.AssertionError(
elif path_stat.st_ino != fd_stat.st_ino:
raise errors.AssertionError(
- "{} changed between open and stat calls".format(source))
+
u
"{} changed between open and stat calls".format(source))
else:
self._dependencies[src_path] = tuple(fd_stat)
else:
self._dependencies[src_path] = tuple(fd_stat)
@@
-1347,7
+1347,10
@@
class Collection(RichCollectionBase):
def get_trash_at(self):
if self._api_response and self._api_response["trash_at"]:
def get_trash_at(self):
if self._api_response and self._api_response["trash_at"]:
- return ciso8601.parse_datetime(self._api_response["trash_at"])
+ try:
+ return ciso8601.parse_datetime(self._api_response["trash_at"])
+ except ValueError:
+ return None
else:
return None
else:
return None
@@
-1407,7
+1410,7
@@
class Collection(RichCollectionBase):
copies = (self.replication_desired or
self._my_api()._rootDesc.get('defaultCollectionReplication',
2))
copies = (self.replication_desired or
self._my_api()._rootDesc.get('defaultCollectionReplication',
2))
- self._block_manager = _BlockManager(self._my_keep(), copies=copies, put_threads=self.put_threads)
+ self._block_manager = _BlockManager(self._my_keep(), copies=copies, put_threads=self.put_threads
, num_retries=self.num_retries
)
return self._block_manager
def _remember_api_response(self, response):
return self._block_manager
def _remember_api_response(self, response):