[ARVADOS] created: f49bc2790a18de14e22e69fb39f93805488fdbb3
Git user
git at public.curoverse.com
Mon Apr 10 10:07:30 EDT 2017
at f49bc2790a18de14e22e69fb39f93805488fdbb3 (commit)
commit f49bc2790a18de14e22e69fb39f93805488fdbb3
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Apr 10 10:07:23 2017 -0400
11332: Use urllib quote/unquote to handle special chars (e.g. '#')
diff --git a/sdk/cwl/arvados_cwl/arvcontainer.py b/sdk/cwl/arvados_cwl/arvcontainer.py
index 3090936..28107b4 100644
--- a/sdk/cwl/arvados_cwl/arvcontainer.py
+++ b/sdk/cwl/arvados_cwl/arvcontainer.py
@@ -1,6 +1,7 @@
import logging
import json
import os
+import urllib
import ruamel.yaml as yaml
@@ -77,7 +78,7 @@ class ArvadosContainer(object):
"portable_data_hash": pdh
}
if len(sp) == 2:
- mounts[p]["path"] = sp[1]
+ mounts[p]["path"] = urllib.unquote(sp[1])
with Perf(metrics, "generatefiles %s" % self.name):
if self.generatefiles["listing"]:
diff --git a/sdk/cwl/arvados_cwl/pathmapper.py b/sdk/cwl/arvados_cwl/pathmapper.py
index 713162f..74401ca 100644
--- a/sdk/cwl/arvados_cwl/pathmapper.py
+++ b/sdk/cwl/arvados_cwl/pathmapper.py
@@ -2,6 +2,7 @@ import re
import logging
import uuid
import os
+import urllib
import arvados.commands.run
import arvados.collection
@@ -34,7 +35,7 @@ class ArvPathMapper(PathMapper):
if "#" in src:
src = src[:src.index("#")]
if isinstance(src, basestring) and ArvPathMapper.pdh_path.match(src):
- self._pathmap[src] = MapperEnt(src, self.collection_pattern % src[5:], "File")
+ self._pathmap[src] = MapperEnt(src, self.collection_pattern % urllib.unquote(src[5:]), "File")
if src not in self._pathmap:
# Local FS ref, may need to be uploaded or may be on keep
# mount.
@@ -44,7 +45,7 @@ class ArvPathMapper(PathMapper):
if isinstance(st, arvados.commands.run.UploadFile):
uploadfiles.add((src, ab, st))
elif isinstance(st, arvados.commands.run.ArvFile):
- self._pathmap[src] = MapperEnt(st.fn, self.collection_pattern % st.fn[5:], "File")
+ self._pathmap[src] = MapperEnt(st.fn, self.collection_pattern % urllib.unquote(st.fn[5:]), "File")
elif src.startswith("_:"):
if "contents" in srcobj:
pass
@@ -59,7 +60,7 @@ class ArvPathMapper(PathMapper):
self.visit(l, uploadfiles)
elif srcobj["class"] == "Directory":
if isinstance(src, basestring) and ArvPathMapper.pdh_dirpath.match(src):
- self._pathmap[src] = MapperEnt(src, self.collection_pattern % src[5:], "Directory")
+ self._pathmap[src] = MapperEnt(src, self.collection_pattern % urllib.unquote(src[5:]), "Directory")
for l in srcobj.get("listing", []):
self.visit(l, uploadfiles)
@@ -90,7 +91,7 @@ class ArvPathMapper(PathMapper):
loc = k["location"]
if loc in already_uploaded:
v = already_uploaded[loc]
- self._pathmap[loc] = MapperEnt(v.resolved, self.collection_pattern % v.resolved[5:], "File")
+ self._pathmap[loc] = MapperEnt(v.resolved, self.collection_pattern % urllib.unquote(v.resolved[5:]), "File")
for srcobj in referenced_files:
self.visit(srcobj, uploadfiles)
@@ -105,7 +106,7 @@ class ArvPathMapper(PathMapper):
project=self.arvrunner.project_uuid)
for src, ab, st in uploadfiles:
- self._pathmap[src] = MapperEnt(st.fn, self.collection_pattern % st.fn[5:], "File")
+ self._pathmap[src] = MapperEnt(urllib.quote(st.fn, "/:+"), self.collection_pattern % st.fn[5:], "File")
self.arvrunner.add_uploaded(src, self._pathmap[src])
for srcobj in referenced_files:
diff --git a/sdk/cwl/tests/arvados-tests.sh b/sdk/cwl/tests/arvados-tests.sh
index 8646704..2c03812 100755
--- a/sdk/cwl/tests/arvados-tests.sh
+++ b/sdk/cwl/tests/arvados-tests.sh
@@ -2,4 +2,4 @@
if ! arv-get d7514270f356df848477718d58308cc4+94 > /dev/null ; then
arv-put --portable-data-hash testdir
fi
-exec cwltest --test arvados-tests.yml --tool $PWD/runner.sh
+exec cwltest --test arvados-tests.yml --tool $PWD/runner.sh $@
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list