当前位置: 首页>>代码示例>>Python>>正文


Python Node.executed方法代码示例

本文整理汇总了Python中pycbc.workflow.core.Node.executed方法的典型用法代码示例。如果您正苦于以下问题:Python Node.executed方法的具体用法?Python Node.executed怎么用?Python Node.executed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pycbc.workflow.core.Node的用法示例。


在下文中一共展示了Node.executed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_veto_segs

# 需要导入模块: from pycbc.workflow.core import Node [as 别名]
# 或者: from pycbc.workflow.core.Node import executed [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
开发者ID:jsread,项目名称:pycbc,代码行数:71,代码来源:segment.py


注:本文中的pycbc.workflow.core.Node.executed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。