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
-
pause_instance
(instance_id)[source]¶ Pauses the instance - retaining disks and configuration.
Parameters: instance_id (str) – instance identifier Returns: dict - Dictionary of configuration required to restart instance.
-
resume_instance
(instance_config)[source]¶ 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.
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: Dictionary of instance attributes to record.
-
-
class
elasticluster.providers.
AbstractSetupProvider
[source]¶ TODO: define…
-
HUMAN_READABLE_NAME
= 'setup provider'¶ to identify this provider type in messages; override in subclasses
-
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, 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.
Parameters: - 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.
Returns: True if the cluster is correctly configured, even if the method didn’t actually do anything. False if the cluster is not configured.
- cluster (
-