MRS API

The MapReduce Service Class

The CBR high-level interface is available through the mrs member of a Connection object. The mrs member will only be added if the otcextensions.sdk.register_otc_extensions(conn) method is called.

Cluster Operations

class otcextensions.sdk.mrs.v1._proxy.Proxy(session, *args, **kwargs)
clusters(**query)

Retrieve a generator of clusters

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned.

Returns:

A generator of cluster ClusterInfo instances

get_cluster(cluster)

Get a cluster

Parameters:

cluster – The value can be the ID or an instance of ClusterInfo

Returns:

Cluster instance

Return type:

ClusterInfo

find_cluster(name_or_id, ignore_missing=True)

Find a single Cluster by name or id

Parameters:
  • name_or_id – The name or ID of a Cluster

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent group.

Returns:

None

update_cluster(cluster, **attrs)

Update Cluster attributes

Parameters:
  • cluster – The id or an instance of ClusterInfo

  • attrs (dict) – attributes for update on ClusterInfo

Return type:

ClusterInfo

delete_cluster(cluster, ignore_missing=True)

Delete (release) a cluster

Parameters:
  • cluster – The value can be the ID of a cluster or a ClusterInfo instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the host does not exist. When set to True, no exception will be set when attempting to delete a nonexistent host.

Returns:

Cluster been deleted

Return type:

Cluster

hosts(**query)

Retrieve a generator of hosts

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned.

Returns:

A generator of host Host instances

Datasource Operations

class otcextensions.sdk.mrs.v1._proxy.Proxy(session, *args, **kwargs)
datasources(**query)

Retrieve a generator of datasources

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • marker: pagination marker

  • limit: pagination limit

Returns:

A generator of datasoruce Datasource instances

create_datasource(**attrs)

Create (allocate) a new ds from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Datasource, comprised of the properties on the Datasource class.

Returns:

The results of datasoruce creation

Return type:

Datasource

get_datasource(datasource)

Get a datasource

Parameters:

datasource – The value can be the ID or an instance of Datasource

Returns:

Datasource instance

Return type:

Datasource

delete_datasource(datasource, ignore_missing=True)

Delete (release) a datasource

Parameters:
  • datasource – The value can be the ID of a datasource or a Datasource .

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the host does not exist. When set to True, no exception will be set when attempting to delete a nonexistent host.

Returns:

datasource been deleted

Return type:

Datasource

find_datasource(name_or_id, ignore_missing=True)

Find a single datasource

Parameters:
  • name_or_id – The name or ID of a datasource

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the host does not exist. When set to True, no exception will be set when attempting to delete a nonexistent ds.

Returns:

None

update_datasource(datasource, **attrs)

Update ds attributes

Parameters:
  • datasource – The id or an instance of Datasource

  • attrs (dict) – attributes for update on Datasource

Return type:

Datasource

Jobbinary Operations

class otcextensions.sdk.mrs.v1._proxy.Proxy(session, *args, **kwargs)
jobbinaries(**query)

Retrieve a generator of jobbinaries

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • marker: pagination marker

  • limit: pagination limit

Returns:

A generator of jobbinary Jobbinary instances

create_jobbinary(**attrs)

Create a new jobbinary

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Jobbinary, comprised of the properties on the Jobbinary class.

Returns:

The results of datasoruce creation

Return type:

Jobbinary

get_jobbinary(jobbinary)

Get a jobbinary

Parameters:

jobbinary – The value can be the ID or an instance of Jobbinary

Returns:

Jobbinary instance

Return type:

Jobbinary

delete_jobbinary(jobbinary, ignore_missing=True)

Delete (release) a jobbinary

Parameters:
  • jobbinary – The value can be the ID of a jobbinary or a Jobbinary .

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the host does not exist. When set to True, no exception will be set when attempting to delete a nonexistent host.

Return type:

Jobbinary

find_jobbinary(name_or_id, ignore_missing=True)

Find a single jobbinary

Parameters:
  • name_or_id – The name or ID of a jobbinary

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the host does not exist. When set to True, no exception will be set when attempting to delete a nonexistent ds.

Returns:

None

update_jobbinary(jobbinary, **attrs)

Update jobbinary attributes

Parameters:
  • jobbinary – The id or an instance of Jobbinary

  • attrs (dict) – attributes for update on Jobbinary

Return type:

Jobbinary

Job Operations

class otcextensions.sdk.mrs.v1._proxy.Proxy(session, *args, **kwargs)
jobs(**query)

Retrieve a generator of jobs

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • marker: pagination marker

  • limit: pagination limit

Returns:

A generator of jobs Job instances

create_job(**attrs)

Create (allocate) a new job from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Job, comprised of the properties on the Job class.

Returns:

The results of job creation

Return type:

Job

get_job(job)

Get a job

Parameters:

job – The value can be the ID or an instance of Job

Returns:

Job instance

Return type:

Job

delete_job(job, ignore_missing=True)

Delete (release) a job

Parameters:
  • job – The value can be the ID of a job or a Job .

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the host does not exist. When set to True, no exception will be set when attempting to delete a nonexistent host.

Returns:

Job been deleted

Return type:

Job

find_job(name_or_id, ignore_missing=True)

Find a single job

Parameters:
  • name_or_id – The name or ID of a job

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the host does not exist. When set to True, no exception will be set when attempting to delete a nonexistent job.

Returns:

None

update_job(job, **attrs)

Update job attributes

Parameters:
  • job – The id or an instance of Job

  • attrs (dict) – attributes for update on Job

Return type:

Job