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


Python Scheduler.wait_until_finish方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import wait_until_finish [as 别名]

#.........这里部分代码省略.........
        del better_trial_operations

        if finished == True:
            return False

        self.write_log_file("")
        self.write_log_file("")
        self.iteration_number += 1
        return True

    def reconcile_base_tree(self, iteration_folder):
        """
        Reconcile the base tree with every gene tree
        """
        # Create base tree folder
        base_tree_folder = iteration_folder+"/base/"
        os.mkdir(base_tree_folder)

        # Create and submit the cogbox
        base_tree = copy.deepcopy(self.species_tree)
        selected_trees = self.gene_trees.get_trees()
        base_cogbox = CogBox(base_tree, \
            self.gene_trees, \
            selected_trees, \
            self.penalty_dict, \
            self.scheduler)
        info_file_location = base_tree_folder+"input"
        output_file_location = base_tree_folder+"output"
        base_cogbox.run(info_file_location, output_file_location)

        # Run the job and wait until finished
        real_reconciliation_time = time.time()
        self.scheduler.run_job()
        self.scheduler.wait_until_finish()
        real_reconciliation_time = time.time() - real_reconciliation_time
        base_cogbox.statistics['real_run_time'] = real_reconciliation_time
        base_cogbox.read_output()

        return base_cogbox

    def evaluate_base_tree(self, base_cogbox):
        """
        Read the output and run some statistics on the base cogbox
        """
        # Calculate statistics
        self.write_log_file("Base Tree Weighted Score: "+\
            str(base_cogbox.statistics['average_hgt_weighted_score']))
        #str(base_cogbox.statistics['average_score']))
        self.write_log_file("Base Tree Unique HGT: "+\
            str(len(base_cogbox.statistics['hgt_frequencies'])))
        self.write_log_file("Base Tree Unique Events: "+\
            str(len(base_cogbox.statistics['event_frequencies'])))
        self.write_log_file("Base Tree Real Time: "+\
            str(base_cogbox.statistics['real_run_time']))
        self.write_log_file("Base Tree CPU Time: "+\
            str(base_cogbox.statistics['cpu_run_time']))
        #return base_cogbox.statistics['average_score']
        return base_cogbox.statistics['average_hgt_weighted_score']


    def choose_sprs(self, base_cogbox):
        """
        This method parses the output of the base tree reconciliations
        It will then choose the best SPRs to run
        """
        # Sort sprs by frequency
开发者ID:almlab,项目名称:crank,代码行数:70,代码来源:Crank.py


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