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


Python _base.Executor方法代码示例

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


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

示例1: __init__

# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Executor [as 别名]
def __init__(
        self,
        tasks: Sequence[AbstractExecutorTask],
        task_fail_policy=ExecutorExceptionPolicies.propagate,
    ) -> None:
        """
        Init executor.

        :param tasks: sequence of AbstractExecutorTask instances to run.
        :param task_fail_policy: the exception policy of all the tasks
        """
        self._task_fail_policy: ExecutorExceptionPolicies = task_fail_policy
        self._tasks: Sequence[AbstractExecutorTask] = tasks
        self._is_running: bool = False
        self._future_task: Dict[Awaitable, AbstractExecutorTask] = {}
        self._loop: AbstractEventLoop = asyncio.new_event_loop()
        self._executor_pool: Optional[Executor] = None
        self._set_executor_pool() 
开发者ID:fetchai,项目名称:agents-aea,代码行数:20,代码来源:multiple_executor.py

示例2: post

# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Executor [as 别名]
def post(self, message):
        """
        analagous to _base.Executor.submit, but sends a message to the actor
        controlled by this Executor, and returns a Future.
        """
        raise NotImplementedError(
            'use ProcessActorExecutor or ThreadActorExecutor') 
开发者ID:Erotemic,项目名称:ibeis,代码行数:9,代码来源:_base_actor.py

示例3: _start_queue_management_thread

# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Executor [as 别名]
def _start_queue_management_thread(self):
        if self._queue_management_thread is None:
            # When the executor gets garbarge collected, the weakref callback
            # will wake up the queue management thread so that it can terminate
            # if there is no pending work item.
            def weakref_cb(_,
                           thread_wakeup=self._queue_management_thread_wakeup):
                mp.util.debug('Executor collected: triggering callback for'
                              ' QueueManager wakeup')
                thread_wakeup.wakeup()
            # Start the processes so that their sentinels are known.
            self._adjust_process_count()
            self._queue_management_thread = threading.Thread(
                target=_queue_management_worker,
                args=(weakref.ref(self, weakref_cb),
                      self._processes,
                      self._pending_work_items,
                      self._work_ids,
                      self._call_queue,
                      self._result_queue,
                      self._queue_management_thread_wakeup),
                name="QueueManagerThread")
            self._queue_management_thread.daemon = True
            self._queue_management_thread.start()
            _threads_wakeups[self._queue_management_thread] = \
                self._queue_management_thread_wakeup 
开发者ID:CedricGuillemet,项目名称:Imogen,代码行数:28,代码来源:process.py

示例4: _make_executor

# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Executor [as 别名]
def _make_executor(
        self, mode: str, fail_policy: ExecutorExceptionPolicies
    ) -> AbstractMultipleExecutor:
        """
        Make an executor instance to run agents with.

        :param mode: executor mode to use.
        :param fail_policy: one of ExecutorExceptionPolicies to be used with Executor

        :return: aea executor instance
        """
        executor_cls = self.SUPPORTED_MODES[mode]
        return executor_cls(tasks=self._make_tasks(), task_fail_policy=fail_policy) 
开发者ID:fetchai,项目名称:agents-aea,代码行数:15,代码来源:multiple_executor.py


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