src.engines¶
Contents¶
Submodules¶
src.engines.local¶
The class implementing the engine representing the local machine.
- class LocalEngine¶
Bases:
objectThe engine representing the local machine.
- TIME_BETWEEN_INSTANCES = 10¶
The time in seconds that must elapse between creation of instances.
- __init__(project_folder: str)¶
The constructor.
- Parameters:
project_folder¶ (str) – The project folder in dot notation, e.g.
'examples.agent_assignment'.
- is_local()¶
Returns
Trueto signify that this engine is local.- Returns:
True- Return type:
bool
- next_instance_name(role: InstanceRole) str¶
Generate the name for the next instance with the given role.
- Parameters:
role¶ (InstanceRole) – The role of the instance.
- Returns:
The name for the next instance with the given role.
- Return type:
str
- create_instance(_name, _role) str¶
Create the instance of the given type and return its IP address. For the local engine, this simply returns the IP address of the local host.
- Returns:
The IP address of the local host.
- Return type:
str
- run_instance(name: str, _ip, role: InstanceRole, server_port: int, max_cpus: Optional[int] = None)¶
Run the instance.
- Parameters:
name¶ (str) – The name of the instance to be run.
role¶ (InstanceRole) – The role of the instance to be run.
server_port¶ (int) – The port for handshaking with the primary server.
max_cpus¶ (int, optional) – The maximum number of workers to be used by the client instance, defaults to
None, i.e. unlimited.
- kill_instance(name: str)¶
Terminates the specified instance.
- Parameters:
name¶ (str) – The name of the instance to terminate.
- kill_dangling_instances(_existing_clients)¶
This method is provided for the local engine for compatibility only.