grey_run.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:python-GreyTheory 作者: Kalvar 项目源码 文件源码
def _execute_models(self, gmnn_queue=[], is_gm11=False): 
        if self._is_empty(gmnn_queue):
            return []
        pool        = mp.Pool()
        cpu_count   = self.cpu_count
        length      = len(gmnn_queue)
        block_count = long(math.ceil(length / float(cpu_count)))
        start_index = 0
        end_length  = cpu_count
        for block in xrange(0, block_count):
            for gm_model in gmnn_queue[start_index:end_length]:
                if is_gm11 == False:
                    pool.apply_async(gm_model.analyze())
                else:
                    pool.apply_async(gm_model.forecast())

            start_index += cpu_count
            end_length  += cpu_count
            if end_length > length:
                end_length = length

        self._close_pool(pool)
        return gmnn_queue
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号