elasticluster.providers

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

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

get_ips(instance_id)[source]

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

Returns:list (IPs)
is_instance_running(instance_id)[source]

Checks if the instance is up and running.

Parameters:instance_id (str) – instance identifier
Returns:bool - True if running, False otherwise
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.

Parameters:
  • 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
Returns:

str - instance id of the started instance

stop_instance(instance_id)[source]

Stops the instance gracefully.

Parameters:instance_id (str) – instance identifier
Returns:None
class elasticluster.providers.AbstractSetupProvider[source]

TODO: define...

cleanup()[source]

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

Returns:None
setup_cluster(cluster)[source]

Configures all nodes of a cluster to function in respect to the given configuration.

This method must be idempotent, i.e. it should always be safe calling it multiple times..

Parameters:cluster (elasticluster.cluster.Cluster) – cluster to configure
Returns:True if the cluster is correctly configured, even if the method didn’t actually do anything. False if the cluster is not configured.