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