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:
- 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 toTrue
, 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 toTrue
, no exception will be set when attempting to delete a nonexistent host.
- Returns:
Cluster been deleted
- Return type:
- 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:
- get_datasource(datasource)
Get a datasource
- Parameters:
datasource – The value can be the ID or an instance of
Datasource
- Returns:
Datasource instance
- Return type:
- 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 toTrue
, no exception will be set when attempting to delete a nonexistent host.
- Returns:
datasource been deleted
- Return type:
- 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 toTrue
, 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:
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
- get_jobbinary(jobbinary)
Get a jobbinary
- delete_jobbinary(jobbinary, ignore_missing=True)
Delete (release) a 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 toTrue
, no exception will be set when attempting to delete a nonexistent ds.
- Returns:
None
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
- get_job(job)
Get a job
- delete_job(job, ignore_missing=True)
Delete (release) a 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 toTrue
, no exception will be set when attempting to delete a nonexistent job.
- Returns:
None