src.engines.gce

Submodules

src.engines.gce.engine

The class for working with the Google Compute Engine.

class GCE

Bases: AbstractEngine

The google compute engine.

__init__(config)

The constructor.

Parameters:

config – The configuration dictionary with the following keys:

  • prefix - the prefix used for the names of instances.

  • project - the name of the project on the cloud.

  • zone - the zone where the instances are to be located.

  • server_image - the name of the machine image for a server.

  • client_image - the name of the machine image for a server.

  • root_folder - the path to the root folder, e.g. ~/ExpoCloud/.

  • project_folder - the path to the experiment in dot notation, e.g. 'examples.agent_assignment'.

create_instance_native(name: str, image: str) Optional[str]

Creates a new instance based on the image with the given name. If successful, returns the internal IP address of the new instance. Otherwise, returns None.

Parameters:
  • name (str) – The name to be assigned to the new instance.

  • image (str) – The name of the machine image for the new instance.

Returns:

The internal IP address of the new instance or None.

Return type:

Union[str, None]

list_instances() List[tuple]

Returns list of tuples (<name>, <ip>, <status>) for each instance. :return: The list of tuples (<name>, <ip>, <status>) for each instance. :rtype: List[tuple]

kill_instance(name) str

Terminates the specified instance.

Parameters:

name (str) – The name of the instance to terminate.

Returns:

The name of the terminated instance or None in the case of an exception.

Return type:

str

ip_from_name_(name: str) Optional[str]

Return the IP address of the instance with the specified name. The internal IP address is returned. This method should not be invoked directly.

Parameters:

name (str) – The name of the instance whose IP address is required.

Returns:

The IP address of the instance with the specified name or None in the case of an exception.

Return type:

Union[str, None]