API documentation for interacting with CloudMan

class bioblend.cloudman.launch.CloudManLauncher(access_key, secret_key, cloud=None)[source]

Define the environment in which this instance of CloudMan will be launched.

Besides providing the credentials, optionally provide the cloud object. This object must define the properties required to establish a boto connection to that cloud. See this method’s implementation for an example of the required fields. Note that as long the as provided object defines the required fields, it can really by implemented as anything (e.g., a Bunch, a database object, a custom class). If no value for the cloud argument is provided, the default is to use the Amazon cloud.

_checkURL(url)[source]

Check if the url is alive (i.e., remote server returns code 200(OK) or 401 (unauthorized)).

_compose_user_data(user_provided_data)[source]

A convenience method used to compose and properly format the user data required when requesting an instance.

user_provided_data is the data provided by a user required to identify a cluster and user other user requirements.

_find_placements(ec2_conn, instance_type, cloud_type)[source]

Find an EC2 region zone that supports the requested instance type.

We do this by checking the spot prices in the potential availability zones for support before deciding on a region: http://blog.piefox.com/2011/07/ec2-availability-zones-and-instance.html

If instance_type is None, finds all zones that are currently available.

Note that, currently, this only applies to AWS. For other clouds, all the available zones are returned.

_get_cloud_info(cloud, as_str=False)[source]

Get connection information about a given cloud

connect_ec2(a_key, s_key, cloud=None)[source]

Create and return an EC2-compatible connection object for the given cloud.

See _get_cloud_info method for more details on the requirements for the cloud parameter. If no value is provided, the class field is used.

create_cm_security_group(sg_name='CloudMan')[source]

Create a security group with all authorizations required to run CloudMan. If the group already exists, check its rules and add the missing ones. Return the name of the created security group.

create_key_pair(key_name='cloudman_key_pair')[source]

Create a key pair with the provided key_name. Return the name of the key or None if there was an error creating the key.

get_status(instance_id)[source]

Check on the status of an instance. If instance_id is not provided, the ID obtained when launching the most recent instance is used. Note that this assumes the instance being checked on was launched using this class. Also note that the same class may be used to launch multiple instances but only the most recent instance_id is kept while any others will need to be explicitly specified.

This method also allows the required ec2_conn connection object to be provided at invocation time. If the object is not provided, credentials defined for the class are used (ability to specify a custom ec2_conn helps in case of stateless method invocations).

Return a state dict with the current instance_state, public_ip, placement, and error keys, which capture the current state (the values for those keys default to empty string if no data is available from the cloud).

launch(cluster_name, image_id, instance_type, password, kernel_id=None, ramdisk_id=None, key_name='cloudman_key_pair', security_groups=['CloudMan'], placement='', **kwargs)[source]

Check all the prerequisites (key pair and security groups) for launching a CloudMan instance, compose the user data based on the parameters specified in the arguments and the cloud properties as defined in the object’s cloud field.

For the current list of user data fields that can be provided via kwargs, see http://wiki.g2.bx.psu.edu/CloudMan/UserData

Return a dict containing the properties and info with which an instance was launched, namely: sg_names containing the names of the security groups, kp_name containing the name of the key pair, kp_material containing the private portion of the key pair (note that this portion of the key is available and can be retrieved only at the time the key is created, which will happen only if no key with the name provided in the key_name argument exists), rs containing the boto ResultSet object, instance_id containing the ID of a started instance, and error containing an error message if there was one.

rule_exists(rules, from_port, to_port, ip_protocol='tcp', cidr_ip='0.0.0.0/0')[source]

A convenience method to check if an authorization rule in a security group already exists.

class bioblend.cloudman.CloudManInstance(url, password, **kwargs)[source]

Create an instance of the CloudMan API class, which is to be used when manipulating that given CloudMan instance.

The url is a string defining the address of CloudMan, for example “http://115.146.92.174”. The password is CloudMan’s password, as defined in the user data sent to CloudMan on instance creation.

add_nodes(*args, **kwargs)[source]

Add a number of worker nodes to the cluster, optionally specifying the type for new instances. If instance_type is not specified, instance(s) of the same type as the master instance will be started. Note that the instance_type must match the type of instance available on the given cloud.

spot_price applies only to AWS and, if set, defines the maximum price for Spot instances, thus turning this request for more instances into a Spot request.

adjust_autoscaling(*args, **kwargs)[source]

Adjust the autoscaling configuration parameters.

The number of worker nodes in the cluster is bounded by the optional minimum_nodes and maximum_nodes parameters. If a parameter is not provided then its configuration value does not change.

autoscaling_enabled(*args, **kwargs)[source]

Returns a boolean indicating whether autoscaling is enabled.

disable_autoscaling(*args, **kwargs)[source]

Disable autoscaling, meaning that worker nodes will need to be manually added and removed.

enable_autoscaling(*args, **kwargs)[source]

Enable cluster autoscaling, allowing the cluster to automatically add, or remove, worker nodes, as needed.

The number of worker nodes in the cluster is bounded by the minimum_nodes (default is 0) and maximum_nodes (default is 19) parameters.

get_cloudman_url()[source]
get_cluster_size(*args, **kwargs)[source]

Get the size of the cluster in terms of the number of nodes; this count includes the master node.

get_cluster_type(*args, **kwargs)[source]

Get the type this CloudMan cluster has been initialized to. See the CloudMan docs about the available types. If the cluster has not yet been initialized, this method returns None.

get_galaxy_state(*args, **kwargs)[source]

Get the current status of Galaxy running on the cluster.

get_master_id(*args, **kwargs)[source]

Returns the instance ID of the master node in this Cloudman cluster

get_master_ip(*args, **kwargs)[source]

Returns the public IP of the master node in this Cloudman cluster

get_nodes(*args, **kwargs)[source]

Get a list of nodes currently running in this CloudMan cluster.

get_static_state(*args, **kwargs)[source]

Get static information on this CloudMan instance. i.e. state that doesn’t change over the lifetime of the cluster

get_status(*args, **kwargs)[source]

Get status information on this CloudMan instance.

initialize(*args, **kwargs)[source]

Initialize CloudMan platform. This needs to be done before the cluster can be used.

The type, either ‘Galaxy’ (default), ‘Data’, or ‘SGE’, defines the type of cluster platform to initialize.

static launch_instance(cfg, **kwargs)[source]

Launches a new instance of cloudman on the specified cloud infrastructure.

Parameters:cfg (CloudManConfig) – A CloudManConfig object containing the initial parameters for this launch.
reboot_node(*args, **kwargs)[source]

Reboot a specific worker node.

The instance_id parameter defines the ID, as a string, of a worker node to reboot.

remove_node(*args, **kwargs)[source]

Remove a specific worker node from the cluster.

The instance_id parameter defines the ID, as a string, of a worker node to remove from the cluster. The force parameter (defaulting to False), is a boolean indicating whether the node should be forcibly removed rather than gracefully removed.

remove_nodes(*args, **kwargs)[source]

Remove worker nodes from the cluster.

The num_nodes parameter defines the number of worker nodes to remove. The force parameter (defaulting to False), is a boolean indicating whether the nodes should be forcibly removed rather than gracefully removed.

terminate(*args, **kwargs)[source]

Terminate this CloudMan cluster. There is an option to also terminate the master instance (all worker instances will be terminated in the process of cluster termination), and delete the whole cluster.

Note

Deleting a cluster is irreversible - all of the data will be permanently deleted.

Previous topic

BioBlend

Next topic

API documentation for interacting with Galaxy

This Page