本文整理汇总了Python中pycbc.workflow.core.Node._add_output方法的典型用法代码示例。如果您正苦于以下问题:Python Node._add_output方法的具体用法?Python Node._add_output怎么用?Python Node._add_output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycbc.workflow.core.Node
的用法示例。
在下文中一共展示了Node._add_output方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_node
# 需要导入模块: from pycbc.workflow.core import Node [as 别名]
# 或者: from pycbc.workflow.core.Node import _add_output [as 别名]
def create_node(self, bank):
"""
Set up a CondorDagmanNode class to run lalapps_splitbank code
Parameters
----------
bank : pycbc.workflow.core.File
The OutFile containing the template bank to be split
Returns
--------
node : pycbc.workflow.core.Node
The node to run the job
"""
node = Node(self)
# FIXME: This is a hack because SplitBank fails if given an input file
# whose path contains the character '-' or if the input file is not in
# the same directory as the output. Therefore we just set the path to
# be the local path
fullPath = bank.cache_entry.path
bank.cache_entry.path = os.path.basename(fullPath)
node.add_input_opt('--bank-file', bank)
# FIXME: Set the path back to what it was. This is part of the hack
# above and should be removed if possible.
bank.cache_entry.path = fullPath
# Get the output (taken from inspiral.py)
url_list = []
x = bank.filename.split('-')
if len(x) != 4:
errMsg = "Input file name is not compatible with splitbank. Name "
errMsg += "must follow the lal cache standard, for example "
errMsg += "H1-TMPLTBANK-900000000-1000.xml. "
errMsg += "Got %s." % (bank.filename, )
raise ValueError(errMsg)
for i in range(0, self.num_banks):
out_file = "%s-%s_%2.2d-%s-%s" % (x[0], x[1], i, x[2], x[3])
out_url = urlparse.urlunparse([
'file', 'localhost',
os.path.join(self.out_dir, out_file), None, None, None
])
url_list.append(out_url)
job_tag = bank.description + "_" + self.name.upper()
out_file = File(
bank.ifo,
job_tag,
bank.segment,
file_url=out_url,
tags=bank.tags,
store_file=self.retain_files)
node._add_output(out_file)
return node
示例2: get_veto_segs
# 需要导入模块: from pycbc.workflow.core import Node [as 别名]
# 或者: from pycbc.workflow.core.Node import _add_output [as 别名]
def get_veto_segs(workflow, ifo, category, start_time, end_time, out_dir,
vetoGenJob, tag=None, execute_now=False):
"""
Obtain veto segments for the selected ifo and veto category and add the job
to generate this to the workflow.
Parameters
-----------
workflow: pycbc.workflow.core.Workflow
An instance of the Workflow class that manages the workflow.
ifo : string
The string describing the ifo to generate vetoes for.
category : int
The veto category to generate vetoes for.
start_time : gps time (either int/LIGOTimeGPS)
The time at which to begin searching for segments.
end_time : gps time (either int/LIGOTimeGPS)
The time at which to stop searching for segments.
out_dir : path
The directory in which output will be stored.
vetoGenJob : Job
The veto generation Job class that will be used to create the Node.
tag : string, optional (default=None)
Use this to specify a tag. This can be used if this module is being
called more than once to give call specific configuration (by setting
options in [workflow-datafind-${TAG}] rather than [workflow-datafind]). This
is also used to tag the Files returned by the class to uniqueify
the Files and uniqueify the actual filename.
FIXME: Filenames may not be unique with current codes!
execute_now : boolean, optional
If true, jobs are executed immediately. If false, they are added to the
workflow to be run later.
Returns
--------
veto_def_file : pycbc.workflow.core.OutSegFile
The workflow File object corresponding to this DQ veto file.
"""
segValidSeg = segments.segment([start_time,end_time])
node = Node(vetoGenJob)
node.add_opt('--veto-categories', str(category))
node.add_opt('--ifo-list', ifo)
node.add_opt('--gps-start-time', str(start_time))
node.add_opt('--gps-end-time', str(end_time))
vetoXmlFileName = "%s-VETOTIME_CAT%d-%d-%d.xml" \
%(ifo, category, start_time, end_time-start_time)
vetoXmlFilePath = os.path.abspath(os.path.join(out_dir, vetoXmlFileName))
currUrl = urlparse.urlunparse(['file', 'localhost',
vetoXmlFilePath, None, None, None])
if tag:
currTags = [tag, 'VETO_CAT%d' %(category)]
else:
currTags = ['VETO_CAT%d' %(category)]
vetoXmlFile = OutSegFile(ifo, 'SEGMENTS', segValidSeg, currUrl,
tags=currTags)
node._add_output(vetoXmlFile)
if execute_now:
if file_needs_generating(vetoXmlFile.cache_entry.path):
workflow.execute_node(node)
else:
node.executed = True
for fil in node._outputs:
fil.node = None
fil.PFN(fil.storage_path, site='local')
else:
workflow.add_node(node)
return vetoXmlFile