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 1 commit
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
Prev Previous commit
Next Next commit
Update scandeps to produce nested directory listing to correctly capt…
…ure file

structure.
  • Loading branch information
Peter Amstutz committed Jun 30, 2016
commit e70eeb8cf24e65807a069df1c9b2f429551e34e5
16 changes: 8 additions & 8 deletions cwltool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from . import workflow
from .errors import WorkflowException, UnsupportedRequirement
from .cwlrdf import printrdf, printdot
from .process import shortname, Process, getListing, relocateOutputs, cleanIntermediate
from .process import shortname, Process, getListing, relocateOutputs, cleanIntermediate, scandeps
from .load_tool import fetch_document, validate_document, make_tool
from . import draft2tool
from .builder import adjustFileObjs, adjustDirObjs
Expand Down Expand Up @@ -423,29 +423,29 @@ def pathToLoc(p):
return (job_order_object, input_basedir)


def printdeps(obj, document_loader, stdout, relative_deps, basedir=None):
def printdeps(obj, document_loader, stdout, relative_deps, uri, basedir=None):
# type: (Dict[unicode, Any], Loader, IO[Any], bool, str) -> None
deps = {"class": "File",
"path": obj.get("id", "#")}
"location": uri}

def loadref(b, u):
return document_loader.resolve_ref(u, base_url=b)[0]

sf = scandeps(basedir if basedir else obj["id"], obj,
sf = scandeps(basedir if basedir else uri, obj,
set(("$import", "run")),
set(("$include", "$schemas", "path")), loadref)
set(("$include", "$schemas", "path", "location")), loadref)
if sf:
deps["secondaryFiles"] = sf

if relative_deps:
if relative_deps == "primary":
base = basedir if basedir else os.path.dirname(obj["id"])
base = basedir if basedir else os.path.dirname(uri)
elif relative_deps == "cwd":
base = "file://" + os.getcwd()
else:
raise Exception(u"Unknown relative_deps %s" % relative_deps)
def makeRelative(ob):
u = ob["location"]
u = ob.get("location", ob.get("path"))
if ":" in u.split("/")[0] and not u.startswith("file://"):
pass
else:
Expand Down Expand Up @@ -604,7 +604,7 @@ def main(argsl=None,
document_loader, workflowobj, uri = fetch_document(args.workflow)

if args.print_deps:
printdeps(workflowobj, document_loader, stdout, args.relative_deps)
printdeps(workflowobj, document_loader, stdout, args.relative_deps, uri)
return 0

document_loader, avsc_names, processobj, metadata, uri \
Expand Down
46 changes: 43 additions & 3 deletions cwltool/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,41 @@ def uniquename(stem): # type: (unicode) -> unicode
_names.add(u)
return u

def nestdir(base, deps):
dirname = os.path.dirname(base) + "/"
subid = deps["location"]
if subid.startswith(dirname):
s2 = subid[len(dirname):]
sp = s2.split('/')
sp.pop()
while sp:
nx = sp.pop()
deps = {
"entryname": nx,
"entry": {
"class": "Directory",
"listing": [deps]
}
}
return deps

def mergedirs(listing):
r = []
ents = {}
for e in listing:
if "entryname" in e:
if e["entryname"] not in ents:
ents[e["entryname"]] = e
elif e["entry"]["class"] == "Directory":
ents[e["entryname"]]["entry"]["listing"].extend(e["entry"]["listing"])
else:
r.append(e)
for e in ents.itervalues():
if e["entry"]["class"] == "Directory":
e["entry"]["listing"] = mergedirs(e["entry"]["listing"])
r.extend(ents.itervalues())
return r

def scandeps(base, doc, reffields, urlfields, loadref):
# type: (unicode, Any, Set[str], Set[str], Callable[[unicode, str], Any]) -> List[Dict[str, str]]
r = []
Expand All @@ -574,20 +609,25 @@ def scandeps(base, doc, reffields, urlfields, loadref):
deps = {
"class": "File",
"location": subid
} # type: Dict[str, Any]
} # type: Dict[str, Any]
sf = scandeps(subid, sub, reffields, urlfields, loadref)
if sf:
deps["secondaryFiles"] = sf
deps = nestdir(base, deps)
r.append(deps)
elif k in urlfields:
for u in aslist(v):
r.append({
deps = {
"class": "File",
"location": urlparse.urljoin(base, u)
})
}
deps = nestdir(base, deps)
r.append(deps)
else:
r.extend(scandeps(base, v, reffields, urlfields, loadref))
elif isinstance(doc, list):
for d in doc:
r.extend(scandeps(base, d, reffields, urlfields, loadref))

r = mergedirs(r)
return r