Executor¶
- class Executor(service_name: str, name: str, context)[source]¶
Bases:
Proxy
[BlockingExecutor
]An object that executes submitted executable tasks.
- execute_on_key_owner(key: Any, task: Any) Future[Any] [source]¶
Executes a task on the owner of the specified key.
- Parameters:
key – The specified key.
task – A task executed on the owner of the specified key.
- Returns:
The result of the task.
- execute_on_member(member: MemberInfo, task: Any) Future[Any] [source]¶
Executes a task on the specified member.
- Parameters:
member – The specified member.
task – The task executed on the specified member.
- Returns:
The result of the task.
- execute_on_members(members: Sequence[MemberInfo], task: Any) Future[List[Any]] [source]¶
Executes a task on each of the specified members.
- Parameters:
members – The specified members.
task – The task executed on the specified members.
- Returns:
The list of results of the tasks on each member.
- execute_on_all_members(task: Any) Future[List[Any]] [source]¶
Executes a task on all the known cluster members.
- Parameters:
task – The task executed on the all the members.
- Returns:
The list of results of the tasks on each member.
- is_shutdown() Future[bool] [source]¶
Determines whether this executor has been shutdown or not.
- Returns:
True
if the executor has been shutdown,False
otherwise.
- shutdown() Future[None] [source]¶
Initiates a shutdown process which works orderly. Tasks that were submitted before shutdown are executed but new task will not be accepted.
- blocking() BlockingExecutor [source]¶
Returns a version of this proxy with only blocking method calls.
- class BlockingExecutor(wrapped: Executor)[source]¶
Bases:
Executor
- name¶
- service_name¶
- execute_on_key_owner(key: Any, task: Any) Any [source]¶
Executes a task on the owner of the specified key.
- Parameters:
key – The specified key.
task – A task executed on the owner of the specified key.
- Returns:
The result of the task.
- execute_on_member(member: MemberInfo, task: Any) Any [source]¶
Executes a task on the specified member.
- Parameters:
member – The specified member.
task – The task executed on the specified member.
- Returns:
The result of the task.
- execute_on_members(members: Sequence[MemberInfo], task: Any) List[Any] [source]¶
Executes a task on each of the specified members.
- Parameters:
members – The specified members.
task – The task executed on the specified members.
- Returns:
The list of results of the tasks on each member.
- execute_on_all_members(task: Any) List[Any] [source]¶
Executes a task on all the known cluster members.
- Parameters:
task – The task executed on the all the members.
- Returns:
The list of results of the tasks on each member.
- is_shutdown() bool [source]¶
Determines whether this executor has been shutdown or not.
- Returns:
True
if the executor has been shutdown,False
otherwise.
- shutdown() None [source]¶
Initiates a shutdown process which works orderly. Tasks that were submitted before shutdown are executed but new task will not be accepted.
- blocking() BlockingExecutor [source]¶
Returns a version of this proxy with only blocking method calls.