class elasticluster.providers.AbstractCloudProvider(**config)[source]

Defines the contract for a cloud provider to proper function with elasticluster.


Retrieves the private and public ip addresses for a given instance.

Returns:list (IPs)

Checks if the instance is up and running.

Parameters:instance_id (str) – instance identifier
Returns:bool - True if running, False otherwise

Pauses the instance - retaining disks and configuration.

Parameters:instance_id (str) – instance identifier
Returns:dict - Dictionary of configuration required to restart instance.

Restart an instance from a dictionary of configuration.

Parameters:instance_config (dict) – Dictionary of configuration returned from pause_instance()
Returns:str - instance_id
start_instance(key_name, public_key_path, private_key_path, security_group, flavor, image_id, image_userdata, username=None, node_name=None)[source]

Starts a new instance on the cloud using the given properties. Multiple instances might be started in different threads at the same time. The implementation should handle any problems regarding this itself.

  • key_name (str) – name of the ssh key to connect
  • public_key_path (str) – path to ssh public key
  • private_key_path (str) – path to ssh private key
  • security_group (str) – firewall rule definition to apply on the instance
  • flavor (str) – machine type to use for the instance
  • image_name (str) – image type (os) to use for the instance
  • image_userdata (str) – command to execute after startup
  • username (str) – username for the given ssh key, default None

Dictionary of instance attributes to record.


Stops the instance gracefully.

Parameters:instance_id (str) – instance identifier

Return local state which is relevant for the cluster setup process.

class elasticluster.providers.AbstractSetupProvider[source]

TODO: define…

HUMAN_READABLE_NAME = 'setup provider'

to identify this provider type in messages; override in subclasses


Cleanup any temporary file or directory created during setup. This method is called every time a cluster is stopped.

setup_cluster(cluster, extra_args=())[source]

Configure all nodes of a cluster.

This method must be idempotent, i.e. it should always be safe to call multiple times over.

  • cluster (elasticluster.cluster.Cluster) – cluster to configure
  • extra_args (list) – List of additional command-line arguments that are appended to each invocation of the setup program.

True if the cluster is correctly configured, even if the method didn’t actually do anything. False if the cluster is not configured.