From 9a752eae723dfe23d5b98db8ba7ca600ab9f9573 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Mon, 6 Aug 2018 14:14:04 -0400 Subject: [PATCH] 13931: Support for getting file sizes of files in Keep Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- sdk/cwl/arvados_cwl/fsaccess.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sdk/cwl/arvados_cwl/fsaccess.py b/sdk/cwl/arvados_cwl/fsaccess.py index 15689a9010..9a893df781 100644 --- a/sdk/cwl/arvados_cwl/fsaccess.py +++ b/sdk/cwl/arvados_cwl/fsaccess.py @@ -139,6 +139,17 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess): else: return super(CollectionFsAccess, self).exists(fn) + def size(self, fn): # type: (unicode) -> bool + collection, rest = self.get_collection(fn) + if collection is not None: + if rest: + arvfile = collection.find(rest) + if isinstance(arvfile, arvados.arvfile.ArvadosFile): + return arvfile.size() + raise IOError(errno.EINVAL, "Not a path to a file %s" % (fn)) + else: + return super(CollectionFsAccess, self).size(fn) + def isfile(self, fn): # type: (unicode) -> bool collection, rest = self.get_collection(fn) if collection is not None: -- 2.30.2