Python Sahara client for APIv2

Overview

There is also support for Sahara’s experimental APIv2.

Supported operations

Plugin ops

class saharaclient.api.plugins.PluginManagerV2(api)[source]
get(plugin_name)

Get information about a Plugin.

get_version_details(plugin_name, plugin_version)[source]

Get version details

Get the list of Services and Service Parameters for a specified Plugin and Plugin Version.

list(search_opts=None)

Get a list of Plugins.

update(plugin_name, values)

Update plugin and then return updated result to user

Image Registry ops

class saharaclient.api.images.ImageManagerV2(api)[source]
get(id)

Get information about an image

list(search_opts=None)

Get a list of registered images.

unregister_image(image_id)

Remove an Image from Sahara Image Registry.

update_image(image_id, user_name, desc=None)

Create or update an Image in Image Registry.

Node Group Template ops

class saharaclient.api.node_group_templates.NodeGroupTemplateManagerV2(api)[source]
create(name, plugin_name, plugin_version, flavor_id, description=None, volumes_per_node=None, volumes_size=None, node_processes=None, node_configs=None, floating_ip_pool=None, security_groups=None, auto_security_group=None, availability_zone=None, volumes_availability_zone=None, volume_type=None, image_id=None, is_proxy_gateway=None, volume_local_to_instance=None, use_autoconfig=None, shares=None, is_public=None, is_protected=None, volume_mount_prefix=None, boot_from_volume=None, boot_volume_type=None, boot_volume_availability_zone=None, boot_volume_local_to_instance=None)[source]

Create a Node Group Template.

delete(ng_template_id)

Delete a Node Group Template.

export(ng_template_id)

Export a Node Group Template.

get(ng_template_id)

Get information about a Node Group Template.

list(search_opts=None, marker=None, limit=None, sort_by=None, reverse=None)

Get a list of Node Group Templates.

update(ng_template_id, name=NotUpdated, plugin_name=NotUpdated, plugin_version=NotUpdated, flavor_id=NotUpdated, description=NotUpdated, volumes_per_node=NotUpdated, volumes_size=NotUpdated, node_processes=NotUpdated, node_configs=NotUpdated, floating_ip_pool=NotUpdated, security_groups=NotUpdated, auto_security_group=NotUpdated, availability_zone=NotUpdated, volumes_availability_zone=NotUpdated, volume_type=NotUpdated, image_id=NotUpdated, is_proxy_gateway=NotUpdated, volume_local_to_instance=NotUpdated, use_autoconfig=NotUpdated, shares=NotUpdated, is_public=NotUpdated, is_protected=NotUpdated, volume_mount_prefix=NotUpdated, boot_from_volume=NotUpdated, boot_volume_type=NotUpdated, boot_volume_availability_zone=NotUpdated, boot_volume_local_to_instance=NotUpdated)[source]

Update a Node Group Template.

Cluster Template ops

class saharaclient.api.cluster_templates.ClusterTemplateManagerV2(api)[source]
create(name, plugin_name, plugin_version, description=None, cluster_configs=None, node_groups=None, anti_affinity=None, net_id=None, default_image_id=None, use_autoconfig=None, shares=None, is_public=None, is_protected=None, domain_name=None)[source]

Create a Cluster Template.

delete(cluster_template_id)

Delete a Cluster Template.

export(cluster_template_id)

Export a Cluster Template.

get(cluster_template_id)

Get information about a Cluster Template.

list(search_opts=None, marker=None, limit=None, sort_by=None, reverse=None)

Get list of Cluster Templates.

update(cluster_template_id, name=NotUpdated, plugin_name=NotUpdated, plugin_version=NotUpdated, description=NotUpdated, cluster_configs=NotUpdated, node_groups=NotUpdated, anti_affinity=NotUpdated, net_id=NotUpdated, default_image_id=NotUpdated, use_autoconfig=NotUpdated, shares=NotUpdated, is_public=NotUpdated, is_protected=NotUpdated, domain_name=NotUpdated)[source]

Update a Cluster Template.

Cluster ops

class saharaclient.api.clusters.ClusterManagerV2(api)[source]
create(name, plugin_name, plugin_version, cluster_template_id=None, default_image_id=None, is_transient=None, description=None, cluster_configs=None, node_groups=None, user_keypair_id=None, anti_affinity=None, net_id=None, count=None, use_autoconfig=None, shares=None, is_public=None, is_protected=None)[source]

Launch a Cluster.

delete(cluster_id)

Delete a Cluster.

force_delete(cluster_id)[source]

Force Delete a Cluster.

get(cluster_id, show_progress=False)

Get information about a Cluster.

list(search_opts=None, limit=None, marker=None, sort_by=None, reverse=None)

Get a list of Clusters.

scale(cluster_id, scale_object)[source]

Scale an existing Cluster.

Parameters

scale_object – dict that describes scaling operation

Example

The following scale_object can be used to change the number of instances in the node group (optionally specifiying which instances to delete) or add instances of a new node group to an existing cluster:

{
    "add_node_groups": [
        {
            "count": 3,
            "name": "new_ng",
            "node_group_template_id": "ngt_id"
        }
    ],
    "resize_node_groups": [
        {
            "count": 2,
            "name": "old_ng",
            "instances": ["instance_id1", "instance_id2"]
        }
    ]
}
update(cluster_id, name=NotUpdated, description=NotUpdated, is_public=NotUpdated, is_protected=NotUpdated, shares=NotUpdated)

Update a Cluster.

update_keypair(cluster_id)[source]

Reflect an updated keypair on the cluster.

verification_update(cluster_id, status)

Start a verification for a Cluster.

Data Source ops

class saharaclient.api.data_sources.DataSourceManagerV2(api)[source]
create(name, description, data_source_type, url, credential_user=None, credential_pass=None, is_public=None, is_protected=None, s3_credentials=None)

Create a Data Source.

delete(data_source_id)

Delete a Data Source.

get(data_source_id)

Get information about a Data Source.

list(search_opts=None, limit=None, marker=None, sort_by=None, reverse=None)

Get a list of Data Sources.

update(data_source_id, update_data)

Update a Data Source.

Parameters

update_data (dict) – dict that contains fields that should be updated with new values.

Fields that can be updated:

  • name

  • description

  • type

  • url

  • is_public

  • is_protected

  • credentials - dict with the keys user and password for data source in Swift, or with the keys accesskey, secretkey, endpoint, ssl, and bucket_in_path for data source in S3

Job Binary ops

class saharaclient.api.job_binaries.JobBinariesManagerV2(api)[source]
create(name, url, description=None, extra=None, is_public=None, is_protected=None)

Create a Job Binary.

Parameters

extra (dict) – authentication info needed for some job binaries, containing the keys user and password for job binary in Swift or the keys accesskey, secretkey, and endpoint for job binary in S3

delete(job_binary_id)

Delete a Job Binary.

get(job_binary_id)

Get information about a Job Binary.

get_file(job_binary_id)

Download a Job Binary.

list(search_opts=None, limit=None, marker=None, sort_by=None, reverse=None)

Get a list of Job Binaries.

update(job_binary_id, data)

Update Job Binary.

Parameters

data (dict) – dict that contains fields that should be updated with new values.

Fields that can be updated:

  • name

  • description

  • url

  • is_public

  • is_protected

  • extra - dict with the keys user and password for job binary in Swift, or with the keys accesskey, secretkey, and endpoint for job binary in S3

Job Template ops

class saharaclient.api.v2.job_templates.JobTemplatesManagerV2(api)[source]
create(name, type, mains=None, libs=None, description=None, interface=None, is_public=None, is_protected=None)[source]

Create a Job Template.

delete(job_id)[source]

Delete a Job Template.

get(job_id)[source]

Get information about a Job Template.

get_configs(job_type)[source]

Get config hints for a specified Job Template type.

list(search_opts=None, limit=None, marker=None, sort_by=None, reverse=None)[source]

Get a list of Job Templates.

update(job_id, name=NotUpdated, description=NotUpdated, is_public=NotUpdated, is_protected=NotUpdated)[source]

Update a Job Template.

Job ops

class saharaclient.api.v2.jobs.JobsManagerV2(api)[source]
create(job_template_id, cluster_id, input_id=None, output_id=None, configs=None, interface=None, is_public=None, is_protected=None)[source]

Launch a Job.

delete(obj_id)[source]

Delete a Job.

get(obj_id)[source]

Get information about a Job.

list(search_opts=None, marker=None, limit=None, sort_by=None, reverse=None)[source]

Get a list of Jobs.

refresh_status(obj_id)[source]

Refresh Job Status.

update(obj_id, is_public=NotUpdated, is_protected=NotUpdated)[source]

Update a Job.

Job Types ops

class saharaclient.api.job_types.JobTypesManager(api)[source]
list(search_opts=None)[source]

Get a list of job types supported by plugins.