當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。