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


Python Grid.cancelMultiple方法代码示例

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


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

示例1: __mt_bulk_submit__

# 需要导入模块: from Ganga.Lib.LCG import Grid [as 别名]
# 或者: from Ganga.Lib.LCG.Grid import cancelMultiple [as 别名]
    def __mt_bulk_submit__(self, node_jdls):
        '''submitting jobs in multiple threads'''

        job = self.getJobObject()

        logger.warning(
            'submitting %d subjobs ... it may take a while' % len(node_jdls))

        # the algorithm for submitting a single bulk job
        class MyAlgorithm(Algorithm):

            def __init__(self, masterInputWorkspace, ce, delid):
                Algorithm.__init__(self)
                self.inpw = masterInputWorkspace
                self.ce = ce
                self.delid = delid

            def process(self, jdl_info):
                my_sj_id = jdl_info[0]
                my_sj_jdl = jdl_info[1]

                my_sj_jid = Grid.cream_submit(my_sj_jdl, self.ce, self.delid)

                if not my_sj_jid:
                    return False
                else:
                    self.__appendResult__(my_sj_id, my_sj_jid)
                    return True

        mt_data = []
        for id, jdl in node_jdls.items():
            mt_data.append((id, jdl))

        myAlg = MyAlgorithm(masterInputWorkspace=job.getInputWorkspace(), ce=self.CE, delid=self.delegation_id)
        myData = Data(collection=mt_data)

        runner = MTRunner(name='cream_jsubmit', algorithm=myAlg,
                          data=myData, numThread=config['SubmissionThread'])
        runner.start()
        runner.join(timeout=-1)

        if len(runner.getDoneList()) < len(mt_data):
            # not all bulk jobs are successfully submitted. canceling the
            # submitted jobs on WMS immediately
            logger.error(
                'some bulk jobs not successfully (re)submitted, canceling submitted jobs on WMS')
            Grid.cancelMultiple(runner.getResults().values())
            return None
        else:
            return runner.getResults()
开发者ID:saschastahl,项目名称:ganga,代码行数:52,代码来源:CREAM.py


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