Skip to content

Commit 4c057d4

Browse files
committed
add history server documentation strings
1 parent 9fb9400 commit 4c057d4

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

yarn_api_client/history_server.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88

99
class HistoryServer(BaseYarnAPI):
10+
"""
11+
The history server REST API's allow the user to get status on finished
12+
applications. Currently it only supports MapReduce and provides
13+
information on finished jobs.
14+
"""
1015
def __init__(self, address=None, port=19888, timeout=30):
1116
self.address, self.port, self.timeout = address, port, timeout
1217
if address is None:
@@ -15,13 +20,21 @@ def __init__(self, address=None, port=19888, timeout=30):
1520
self.address, self.port = address, port
1621

1722
def application_information(self):
23+
"""
24+
The history server information resource provides overall information
25+
about the history server.
26+
"""
1827
path = '/ws/v1/history/info'
1928

2029
return self.request(path)
2130

2231
def jobs(self, state=None, user=None, queue=None, limit=None,
2332
started_time_begin=None, started_time_end=None,
2433
finished_time_begin=None, finished_time_end=None):
34+
"""
35+
The jobs resource provides a list of the MapReduce jobs that have
36+
finished. It does not currently return a full list of parameters.
37+
"""
2538
path = '/ws/v1/history/mapreduce/jobs'
2639

2740
legal_states = set([s for s, _ in JobStateInternal])
@@ -44,28 +57,48 @@ def jobs(self, state=None, user=None, queue=None, limit=None,
4457
return self.request(path, **params)
4558

4659
def job(self, job_id):
60+
"""
61+
A Job resource contains information about a particular job identified
62+
by jobid.
63+
"""
4764
path = '/ws/v1/history/mapreduce/jobs/{jobid}'.format(jobid=job_id)
4865

4966
return self.request(path)
5067

5168
def job_attempts(self, job_id):
69+
"""
70+
With the job attempts API, you can obtain a collection of resources
71+
that represent a job attempt.
72+
"""
5273
path = '/ws/v1/history/mapreduce/jobs/{jobid}/jobattempts'.format(
5374
jobid=job_id)
5475

5576
return self.request(path)
5677

5778
def job_counters(self, job_id):
79+
"""
80+
With the job counters API, you can object a collection of resources
81+
that represent al the counters for that job.
82+
"""
5883
path = '/ws/v1/history/mapreduce/jobs/{jobid}/counters'.format(
5984
jobid=job_id)
6085

6186
return self.request(path)
6287

6388
def job_conf(self, job_id):
89+
"""
90+
A job configuration resource contains information about the job
91+
configuration for this job.
92+
"""
6493
path = '/ws/v1/history/mapreduce/jobs/{jobid}/conf'.format(jobid=job_id)
6594

6695
return self.request(path)
6796

6897
def job_tasks(self, job_id, type=None):
98+
"""
99+
With the tasks API, you can obtain a collection of resources that
100+
represent a task within a job.
101+
"""
69102
path = '/ws/v1/history/mapreduce/jobs/{jobid}/tasks'.format(
70103
jobid=job_id)
71104

@@ -83,30 +116,50 @@ def job_tasks(self, job_id, type=None):
83116
return self.request(path, **params)
84117

85118
def job_task(self, job_id, task_id):
119+
"""
120+
A Task resource contains information about a particular task
121+
within a job.
122+
"""
86123
path = '/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}'.format(
87124
jobid=job_id, taskid=task_id)
88125

89126
return self.request(path)
90127

91128
def task_counters(self, job_id, task_id):
129+
"""
130+
With the task counters API, you can object a collection of resources
131+
that represent all the counters for that task.
132+
"""
92133
path = '/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}/counters'.format(
93134
jobid=job_id, taskid=task_id)
94135

95136
return self.request(path)
96137

97138
def task_attempts(self, job_id, task_id):
139+
"""
140+
With the task attempts API, you can obtain a collection of resources
141+
that represent a task attempt within a job.
142+
"""
98143
path = '/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}/attempts'.format(
99144
jobid=job_id, taskid=task_id)
100145

101146
return self.request(path)
102147

103148
def task_attempt(self, job_id, task_id, attempt_id):
149+
"""
150+
A Task Attempt resource contains information about a particular task
151+
attempt within a job.
152+
"""
104153
path = '/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}/attempt/{attemptid}'.format(
105154
jobid=job_id, taskid=task_id, attemptid=attempt_id)
106155

107156
return self.request(path)
108157

109158
def task_attempt_counters(self, job_id, task_id, attempt_id):
159+
"""
160+
With the task attempt counters API, you can object a collection of
161+
resources that represent al the counters for that task attempt.
162+
"""
110163
path = '/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}/attempt/{attemptid}/counters'.format(
111164
jobid=job_id, taskid=task_id, attemptid=attempt_id)
112165

0 commit comments

Comments
 (0)