Skip to content

Commit 2dbd9a6

Browse files
committed
add resource manager signature documentation
1 parent 2f4f123 commit 2dbd9a6

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

yarn_api_client/resource_manager.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ class ResourceManager(BaseYarnAPI):
1212
cluster - status on the cluster, metrics on the cluster,
1313
scheduler information, information about nodes in the cluster,
1414
and information about applications on the cluster.
15+
16+
If `address` argument is `None` client will try to extract `address` and
17+
`port` from Hadoop configuration files.
18+
19+
:param str address: ResourceManager HTTP address
20+
:param int port: ResourceManager HTTP port
21+
:param int timeout: API connection timeout in seconds
1522
"""
1623
def __init__(self, address=None, port=8088, timeout=30):
1724
self.address, self.port, self.timeout = address, port, timeout
@@ -24,6 +31,9 @@ def cluster_information(self):
2431
"""
2532
The cluster information resource provides overall information about
2633
the cluster.
34+
35+
:returns: API response object with JSON data
36+
:rtype: :py:class:`yarn_api_client.base.Response`
2737
"""
2838
path = '/ws/v1/cluster/info'
2939
return self.request(path)
@@ -33,6 +43,9 @@ def cluster_metrics(self):
3343
The cluster metrics resource provides some overall metrics about the
3444
cluster. More detailed metrics should be retrieved from the jmx
3545
interface.
46+
47+
:returns: API response object with JSON data
48+
:rtype: :py:class:`yarn_api_client.base.Response`
3649
"""
3750
path = '/ws/v1/cluster/metrics'
3851
return self.request(path)
@@ -44,6 +57,9 @@ def cluster_scheduler(self):
4457
Capacity Scheduler. You will get different information depending on
4558
which scheduler is configured so be sure to look at the type
4659
information.
60+
61+
:returns: API response object with JSON data
62+
:rtype: :py:class:`yarn_api_client.base.Response`
4763
"""
4864
path = '/ws/v1/cluster/scheduler'
4965
return self.request(path)
@@ -55,6 +71,25 @@ def cluster_applications(self, state=None, final_status=None,
5571
"""
5672
With the Applications API, you can obtain a collection of resources,
5773
each of which represents an application.
74+
75+
:param str state: state of the application
76+
:param str final_status: the final status of the
77+
application - reported by the application itself
78+
:param str user: user name
79+
:param str queue: queue name
80+
:param str limit: total number of app objects to be returned
81+
:param str started_time_begin: applications with start time beginning
82+
with this time, specified in ms since epoch
83+
:param str started_time_end: applications with start time ending with
84+
this time, specified in ms since epoch
85+
:param str finished_time_begin: applications with finish time
86+
beginning with this time, specified in ms since epoch
87+
:param str finished_time_end: applications with finish time ending
88+
with this time, specified in ms since epoch
89+
:returns: API response object with JSON data
90+
:rtype: :py:class:`yarn_api_client.base.Response`
91+
:raises yarn_api_client.errors.IllegalArgumentError: if `state` or
92+
`final_status` incorrect
5893
"""
5994
path = '/ws/v1/cluster/apps'
6095

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

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

@@ -122,6 +174,10 @@ def cluster_application_attempts(self, application_id):
122174
"""
123175
With the application attempts API, you can obtain a collection of
124176
resources that represent an application attempt.
177+
178+
:param str application_id: The application id
179+
:returns: API response object with JSON data
180+
:rtype: :py:class:`yarn_api_client.base.Response`
125181
"""
126182
path = '/ws/v1/cluster/apps/{appid}/appattempts'.format(
127183
appid=application_id)
@@ -132,6 +188,11 @@ def cluster_nodes(self, state=None, healthy=None):
132188
"""
133189
With the Nodes API, you can obtain a collection of resources, each of
134190
which represents a node.
191+
192+
:returns: API response object with JSON data
193+
:rtype: :py:class:`yarn_api_client.base.Response`
194+
:raises yarn_api_client.errors.IllegalArgumentError: if `healthy`
195+
incorrect
135196
"""
136197
path = '/ws/v1/cluster/nodes'
137198
# TODO: validate state argument
@@ -152,6 +213,10 @@ def cluster_nodes(self, state=None, healthy=None):
152213
def cluster_node(self, node_id):
153214
"""
154215
A node resource contains information about a node in the cluster.
216+
217+
:param str node_id: The node id
218+
:returns: API response object with JSON data
219+
:rtype: :py:class:`yarn_api_client.base.Response`
155220
"""
156221
path = '/ws/v1/cluster/nodes/{nodeid}'.format(nodeid=node_id)
157222

0 commit comments

Comments
 (0)