本文整理汇总了Python中job.Job.pathmapper方法的典型用法代码示例。如果您正苦于以下问题:Python Job.pathmapper方法的具体用法?Python Job.pathmapper怎么用?Python Job.pathmapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.pathmapper方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: job
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import pathmapper [as 别名]
def job(self, joborder, basedir, use_container=True):
inputs = joborder['inputs']
Draft4Validator(self.tool['inputs']).validate(inputs)
adapter = self.tool["adapter"]
adapters = [{"order": [-1000000],
"schema": tool_schema_doc["properties"]["adapter"]["properties"]["baseCmd"],
"value": adapter['baseCmd'],
"$ref_base_url": "file:"+toolpath
}]
if "args" in adapter:
for i, a in enumerate(adapter["args"]):
a = copy.copy(a)
if "order" in a:
a["order"] = [a["order"]]
else:
a["order"] = [0]
a["schema"] = tool_schema_doc["definitions"]["strOrExpr"]
adapters.append(a)
adapters.extend(adapt_inputs(self.tool['inputs'], inputs, inputs, ""))
adapters.sort(key=lambda a: a["order"])
referenced_files = filter(lambda a: a is not None, flatten(map(lambda a: find_files(a, joborder), adapters)))
j = Job()
j.tool = self
j.container = None
if 'stdin' in adapter:
j.stdin = flatten(adapt({"value": adapter['stdin'],
"schema": tool_schema_doc["properties"]["adapter"]["properties"]["stdin"],
"$ref_base_url": "file:"+toolpath
}, joborder, None))[0]
referenced_files.append(j.stdin)
else:
j.stdin = None
if 'stdout' in adapter:
j.stdout = flatten(adapt({"value": adapter['stdout'],
"schema": tool_schema_doc["properties"]["adapter"]["properties"]["stdout"],
"$ref_base_url": "file:"+toolpath
}, joborder, None))[0]
if os.path.isabs(j.stdout):
raise Exception("stdout must be a relative path")
else:
j.stdout = None
d = None
a = self.tool.get("requirements")
if a:
b = a.get("environment")
if b:
c = b.get("container")
if use_container and c:
if c.get("type") == "docker":
d = DockerPathMapper(referenced_files, basedir)
j.container = c
if d is None:
d = PathMapper(referenced_files, basedir)
if j.stdin:
j.stdin = j.stdin if os.path.isabs(j.stdin) else os.path.join(basedir, j.stdin)
j.command_line = flatten(map(lambda a: adapt(a, joborder, d.mapper), adapters))
j.pathmapper = d
return j