本文整理汇总了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