Skip to content

Commit 8e757d4

Browse files
author
Peter Amstutz
committed
Add comment about how PathMapper works.
1 parent e23bf6a commit 8e757d4

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

cwltool/pathmapper.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,37 @@ def abspath(src, basedir): # type: (unicode, unicode) -> unicode
8080
class PathMapper(object):
8181

8282
"""Mapping of files from relative path provided in the file to a tuple of
83-
(absolute local path, absolute container path)"""
83+
(absolute local path, absolute container path)
84+
85+
The tao of PathMapper:
86+
87+
The initializer takes a list of File and Directory objects, a base
88+
directory (for resolving relative references) and a staging directory
89+
(where the files are mapped to).
90+
91+
The purpose of the setup method is to determine where each File or
92+
Directory should be placed on the target file system (relative to
93+
stagedir).
94+
95+
If separatedirs=True, unrelated files will be isolated in their own
96+
directories under stagedir. If separatedirs=False, files and directories
97+
will all be placed in stagedir (with the possibility for name
98+
collisions...)
99+
100+
The path map maps the "location" of the input Files and Directory objects
101+
to a tuple (resolved, target, type). The "resolved" field is the "real"
102+
path on the local file system (after resolving relative paths and
103+
traversing symlinks). The "target" is the path on the target file system
104+
(under stagedir). The type is the object type (one of File, Directory,
105+
CreateFile, WritableFile).
106+
107+
The latter two (CreateFile, WritableFile) are used by
108+
InitialWorkDirRequirement to indicate files that are generated on the fly
109+
(CreateFile, in this case "resolved" holds the file contents instead of the
110+
path because they file doesn't exist) or copied into the output directory
111+
so they can be opened for update ("r+" or "a") (WritableFile).
112+
113+
"""
84114

85115
def __init__(self, referenced_files, basedir, stagedir, separateDirs=True):
86116
# type: (List[Any], unicode, unicode, bool) -> None

0 commit comments

Comments
 (0)