X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/af17604c5a93830380fb50db93ce543926c116cf..524c20020594ba67a2a822eccb632f8a5f5dc3ce:/sdk/cwl/arvados_cwl/fsaccess.py diff --git a/sdk/cwl/arvados_cwl/fsaccess.py b/sdk/cwl/arvados_cwl/fsaccess.py index 69f918ead9..15689a9010 100644 --- a/sdk/cwl/arvados_cwl/fsaccess.py +++ b/sdk/cwl/arvados_cwl/fsaccess.py @@ -22,6 +22,8 @@ import arvados.collection import arvados.arvfile import arvados.errors +from googleapiclient.errors import HttpError + from schema_salad.ref_resolver import DefaultFetcher logger = logging.getLogger('arvados.cwl-runner') @@ -32,6 +34,7 @@ class CollectionCache(object): min_entries=2): self.api_client = api_client self.keep_client = keep_client + self.num_retries = num_retries self.collections = OrderedDict() self.lock = threading.Lock() self.total = 0 @@ -54,7 +57,8 @@ class CollectionCache(object): if pdh not in self.collections: logger.debug("Creating collection reader for %s", pdh) cr = arvados.collection.CollectionReader(pdh, api_client=self.api_client, - keep_client=self.keep_client) + keep_client=self.keep_client, + num_retries=self.num_retries) sz = len(cr.manifest_text()) * 128 self.collections[pdh] = (cr, sz) self.total += sz @@ -120,7 +124,13 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess): return super(CollectionFsAccess, self).open(self._abs(fn), mode) def exists(self, fn): - collection, rest = self.get_collection(fn) + try: + collection, rest = self.get_collection(fn) + except HttpError as err: + if err.resp.status == 404: + return False + else: + raise if collection is not None: if rest: return collection.exists(rest)