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


Python process.Process方法代码示例

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


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

示例1: _process_msg

# 需要导入模块: from multiprocessing import process [as 别名]
# 或者: from multiprocessing.process import Process [as 别名]
def _process_msg(self, etl_msg):
        """ Process the given SQS message and run an appropriate step (ET/L).

        :param etl_msg: instance of `:class:boto.sqs.jsonmessage.JSONMessage`
        """
        msg_dict = etl_msg.get_body()

        job = self.create_worker_job(msg_dict)
        et_pool = PoolExtended(processes=self._num_processes)
        self._cond.acquire()
        try:
            while True:
                job.update_action_requests()

                if job.actions['delete_requested'] is True:
                    self._handle_job_delete(job)
                    break

                if not job.cancel_in_progress and job.actions['cancel_requested'] is True:
                    self._handle_cancel_request_lk(job, et_pool)
                    job.cancel_in_progress = True

                if not job.pause_in_progress and job.actions['pause_requested'] is True:
                    # pause the job by waiting for the completion of ongoing run(s) and refusing
                    # any new run.
                    job.pause_in_progress = True

                if job.is_done():
                    break

                if not job.cancel_in_progress:
                    self._schedule_runs_lk(et_pool, job)
                job.is_waiting = True
                self._cond.wait(self._wait_timeout_sec)
                job.update_keepalive()
                job.is_waiting = False
        finally:
            self._cond.release()
            et_pool.close()
            et_pool.join()
        return job.all_results, job.actions 
开发者ID:Yelp,项目名称:mycroft,代码行数:43,代码来源:base_worker.py


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