Skip to content

Commit

Permalink
add resource manager signature documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ediskandarov committed Aug 2, 2014
1 parent 2f4f123 commit 2dbd9a6
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions yarn_api_client/resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ class ResourceManager(BaseYarnAPI):
cluster - status on the cluster, metrics on the cluster,
scheduler information, information about nodes in the cluster,
and information about applications on the cluster.
If `address` argument is `None` client will try to extract `address` and
`port` from Hadoop configuration files.
:param str address: ResourceManager HTTP address
:param int port: ResourceManager HTTP port
:param int timeout: API connection timeout in seconds
"""
def __init__(self, address=None, port=8088, timeout=30):
self.address, self.port, self.timeout = address, port, timeout
Expand All @@ -24,6 +31,9 @@ def cluster_information(self):
"""
The cluster information resource provides overall information about
the cluster.
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
"""
path = '/ws/v1/cluster/info'
return self.request(path)
Expand All @@ -33,6 +43,9 @@ def cluster_metrics(self):
The cluster metrics resource provides some overall metrics about the
cluster. More detailed metrics should be retrieved from the jmx
interface.
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
"""
path = '/ws/v1/cluster/metrics'
return self.request(path)
Expand All @@ -44,6 +57,9 @@ def cluster_scheduler(self):
Capacity Scheduler. You will get different information depending on
which scheduler is configured so be sure to look at the type
information.
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
"""
path = '/ws/v1/cluster/scheduler'
return self.request(path)
Expand All @@ -55,6 +71,25 @@ def cluster_applications(self, state=None, final_status=None,
"""
With the Applications API, you can obtain a collection of resources,
each of which represents an application.
:param str state: state of the application
:param str final_status: the final status of the
application - reported by the application itself
:param str user: user name
:param str queue: queue name
:param str limit: total number of app objects to be returned
:param str started_time_begin: applications with start time beginning
with this time, specified in ms since epoch
:param str started_time_end: applications with start time ending with
this time, specified in ms since epoch
:param str finished_time_begin: applications with finish time
beginning with this time, specified in ms since epoch
:param str finished_time_end: applications with finish time ending
with this time, specified in ms since epoch
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
:raises yarn_api_client.errors.IllegalArgumentError: if `state` or
`final_status` incorrect
"""
path = '/ws/v1/cluster/apps'

Expand Down Expand Up @@ -92,6 +127,19 @@ def cluster_application_statistics(self, state_list=None,
ResourceManager context.
This method work in Hadoop > 2.0.0
:param list state_list: states of the applications, specified as a
comma-separated list. If states is not provided, the API will
enumerate all application states and return the counts of them.
:param list application_type_list: types of the applications,
specified as a comma-separated list. If applicationTypes is not
provided, the API will count the applications of any application
type. In this case, the response shows * to indicate any
application type. Note that we only support at most one
applicationType temporarily. Otherwise, users will expect
an BadRequestException.
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
"""
path = '/ws/v1/cluster/appstatistics'

Expand All @@ -113,6 +161,10 @@ def cluster_application(self, application_id):
"""
An application resource contains information about a particular
application that was submitted to a cluster.
:param str application_id: The application id
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
"""
path = '/ws/v1/cluster/apps/{appid}'.format(appid=application_id)

Expand All @@ -122,6 +174,10 @@ def cluster_application_attempts(self, application_id):
"""
With the application attempts API, you can obtain a collection of
resources that represent an application attempt.
:param str application_id: The application id
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
"""
path = '/ws/v1/cluster/apps/{appid}/appattempts'.format(
appid=application_id)
Expand All @@ -132,6 +188,11 @@ def cluster_nodes(self, state=None, healthy=None):
"""
With the Nodes API, you can obtain a collection of resources, each of
which represents a node.
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
:raises yarn_api_client.errors.IllegalArgumentError: if `healthy`
incorrect
"""
path = '/ws/v1/cluster/nodes'
# TODO: validate state argument
Expand All @@ -152,6 +213,10 @@ def cluster_nodes(self, state=None, healthy=None):
def cluster_node(self, node_id):
"""
A node resource contains information about a node in the cluster.
:param str node_id: The node id
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`
"""
path = '/ws/v1/cluster/nodes/{nodeid}'.format(nodeid=node_id)

Expand Down

0 comments on commit 2dbd9a6

Please sign in to comment.