Skip to content

Pathmapper now has list of file objects and not just file names. #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Jun 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
992e3b1
Pathmapper now has list of file objects and not just file names. Job…
May 27, 2016
35bece8
Merge branch 'master' into stagefiles
Jun 10, 2016
7f979d8
Squashed 'cwltool/schemas/' changes from 3e1b02c..a2263a9
Jun 10, 2016
7e8f87f
Merge commit '7f979d8dc6d664048fe585eeffc1080bd644cb34' into stagefiles
Jun 10, 2016
b6fd457
Input directory staging works.
Jun 14, 2016
aa0b3c8
Fix staging for Docker as well
Jun 14, 2016
5110116
Move getListing to process module. Start looking at capturing output to
Jun 14, 2016
42d1d43
Refactor path mapping/file staging for both setting up inputs and moving
Jun 15, 2016
fa70a55
Fix --cachedir to work with changes to file staging.
Jun 20, 2016
7241deb
Tweak cwltest to accomodate Directory objects.
Jun 21, 2016
6d89d5f
Adding convenience fields to file objects
Jun 22, 2016
66d2d84
Merge commit '51ad4bca0db3052d3bb333401f19d1cbf65eff46' into stagefiles
Jun 23, 2016
51ad4bc
Squashed 'cwltool/schemas/' changes from a2263a9..8798dc8
Jun 23, 2016
9830402
Update to use 'location' URI consistently for identifying files and
Jun 23, 2016
7badf10
Merge commit '049e6e624c2e986acb85c95b63414aea2e87733f' into stagefiles
Jun 23, 2016
049e6e6
Squashed 'cwltool/schemas/' changes from 8798dc8..b449b3d
Jun 23, 2016
07d4505
Unit tests pass
Jun 23, 2016
680ad87
Add updater to draft-4.dev3
Jun 23, 2016
7b42788
Squashed 'cwltool/schemas/' changes from b449b3d..c55f733
Jun 23, 2016
02a8d69
Merge commit '7b42788f4f1a46381854c0797794398d72aba98d' into stagefiles
Jun 23, 2016
319ad26
cwltest support for "location"
Jun 23, 2016
1ce47a3
Merge branch 'master' into stagefiles
Jun 23, 2016
3f52df7
Merge branch 'master' into stagefiles
Jun 23, 2016
71119ba
path -> location fixes for File and Directory. Working on passing co…
Jun 24, 2016
25f2df2
Fixing more path/location bugs and accomodations across versions.
Jun 24, 2016
8ccd28c
Add fixup to updater for expressions in secondaryFiles.
Jun 24, 2016
21081cc
Fix directory handling for location and MapperEnt changes. Fix cwlte…
Jun 24, 2016
f8a4fbe
Update updater so draft-2 still works.
Jun 27, 2016
a14867c
Check for illegal characters in input file name.
Jun 27, 2016
96ee1a5
Merge branch 'master' into stagefiles
Jun 27, 2016
6c174f0
Squashed 'cwltool/schemas/' changes from 41c119b..4efa80b
Jun 27, 2016
00ea24b
Merge commit '6c174f0e1dfd18c18e58b9020f2048352ae2eaae' into stagefiles
Jun 28, 2016
ab51f7d
Merge commit '09abb8b4cacccf0f4ceff5d1f0c5de692cb967d4' into stagefiles
Jun 28, 2016
09abb8b
Squashed 'cwltool/schemas/' changes from 4efa80b..107d005
Jun 28, 2016
3bb59c7
Merge commit '71794a710b27456f04493c89fc04f29d6905605f' into stagefiles
Jun 28, 2016
71794a7
Squashed 'cwltool/schemas/' changes from 107d005..56ef87a
Jun 28, 2016
aba9f8b
Merge commit 'd47df4463c224c05238d58a366e0a37bef22ccf1' into stagefiles
Jun 28, 2016
d47df44
Squashed 'cwltool/schemas/' changes from 56ef87a..5239b16
Jun 28, 2016
bacd841
Use stageFiles for InitialWorkDir
Jun 29, 2016
4728bf0
Pass tests for initial work dir.
Jun 29, 2016
e65b384
Pathmapper wip
Jun 29, 2016
7ac9452
Merge commit 'c332dde31fd6bdee4fe00af9bb89646de1a068c2' into stagefiles
Jun 29, 2016
c332dde
Squashed 'cwltool/schemas/' changes from 5239b16..a5976f3
Jun 29, 2016
b94c87e
Pathmapper handles unified listing/secondaryFiles.
Jun 29, 2016
a85638c
Merge commit 'cb7f18c050334af7b964e84e03f25b975be0880f' into stagefiles
Jun 29, 2016
cb7f18c
Squashed 'cwltool/schemas/' changes from a5976f3..c6538ab
Jun 29, 2016
910725b
Add support for "writable" in InitialWorkDir
Jun 29, 2016
2551f6a
Squashed 'cwltool/schemas/' changes from c6538ab..afe31c1
Jun 29, 2016
ef62092
Merge commit '2551f6a7229ca7b76d3cea15fdfbad035987143e' into stagefiles
Jun 29, 2016
d2270a7
Don't reset real files by accident.
Jun 29, 2016
229565c
cwltest order-independent directory compare.
Jun 30, 2016
e70eeb8
Update scandeps to produce nested directory listing to correctly capt…
Jun 30, 2016
6f9c2f8
s/WHITELIST/ACCEPTLIST/g
mr-c Jun 30, 2016
0397939
Merge remote-tracking branch 'origin/master' into stagefiles
mr-c Jun 30, 2016
3902ed8
Merge remote-tracking branch 'origin/master' into stagefiles
mr-c Jun 30, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions cwltool/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, Union, AnyStr, Callable
from .errors import WorkflowException
from .stdfsaccess import StdFsAccess
from .pathmapper import PathMapper
from .pathmapper import PathMapper, adjustFileObjs, adjustDirObjs

CONTENT_LIMIT = 64 * 1024

Expand All @@ -17,18 +17,6 @@ def substitute(value, replace): # type: (str, str) -> str
else:
return value + replace

def adjustFileObjs(rec, op): # type: (Any, Callable[[Any], Any]) -> None
"""Apply an update function to each File object in the object `rec`."""

if isinstance(rec, dict):
if rec.get("class") == "File":
op(rec)
for d in rec:
adjustFileObjs(rec[d], op)
if isinstance(rec, list):
for d in rec:
adjustFileObjs(d, op)

class Builder(object):

def __init__(self): # type: () -> None
Expand Down Expand Up @@ -114,7 +102,7 @@ def bind_input(self, schema, datum, lead_pos=[], tail_pos=[]):
if schema["type"] == "File":
self.files.append(datum)
if binding and binding.get("loadContents"):
with self.fs_access.open(datum["path"], "rb") as f:
with self.fs_access.open(datum["location"], "rb") as f:
datum["contents"] = f.read(CONTENT_LIMIT)

if "secondaryFiles" in schema:
Expand All @@ -124,11 +112,11 @@ def bind_input(self, schema, datum, lead_pos=[], tail_pos=[]):
if isinstance(sf, dict) or "$(" in sf or "${" in sf:
secondary_eval = self.do_eval(sf, context=datum)
if isinstance(secondary_eval, basestring):
sfpath = {"path": secondary_eval, "class": "File"}
sfpath = {"location": secondary_eval, "class": "File"}
else:
sfpath = secondary_eval
else:
sfpath = {"path": substitute(datum["path"], sf), "class": "File"}
sfpath = {"location": substitute(datum["location"], sf), "class": "File"}
if isinstance(sfpath, list):
datum["secondaryFiles"].extend(sfpath)
else:
Expand All @@ -140,6 +128,10 @@ def _capture_files(f):

adjustFileObjs(datum.get("secondaryFiles", []), _capture_files)

if schema["type"] == "Directory":
self.files.append(datum)


# Position to front of the sort key
if binding:
for bi in bindings:
Expand Down
22 changes: 21 additions & 1 deletion cwltool/cwltest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,30 @@ def compare(a, b): # type: (Any, Any) -> bool
# ignore empty collections
b = {k: v for k, v in b.iteritems()
if not isinstance(v, (list, dict)) or len(v) > 0}
elif a.get("class") == "Directory":
if len(a["listing"]) != len(b["listing"]):
return False
for i in a["listing"]:
found = False
for j in b["listing"]:
try:
if compare(i, j):
found = True
break
except:
pass
if not found:
raise CompareFail(u"%s not in %s" % (json.dumps(i, indent=4, sort_keys=True), json.dumps(b, indent=4, sort_keys=True)))

a = {k: v for k, v in a.iteritems()
if k not in ("path", "location", "listing")}
b = {k: v for k, v in b.iteritems()
if k not in ("path", "location", "listing")}

if len(a) != len(b):
raise CompareFail(u"expected %s\ngot %s" % (json.dumps(a, indent=4, sort_keys=True), json.dumps(b, indent=4, sort_keys=True)))
for c in a:
if a.get("class") != "File" or c != "path":
if a.get("class") != "File" or c not in ("path", "location", "listing"):
if c not in b:
raise CompareFail(u"%s not in %s" % (c, b))
if not compare(a[c], b[c]):
Expand Down
Loading