From f94dae285b2c737f213a5b9058b68fedf5fcdfe4 Mon Sep 17 00:00:00 2001 From: Dmitry Romanenko Date: Mon, 21 Oct 2019 20:00:37 -0400 Subject: [PATCH] Clean documentation --- docs/base.rst | 5 ++ docs/index.rst | 11 +++-- yarn_api_client/application_master.py | 4 +- yarn_api_client/base.py | 6 +++ yarn_api_client/history_server.py | 4 +- yarn_api_client/node_manager.py | 4 +- yarn_api_client/resource_manager.py | 66 +++++++++++++-------------- 7 files changed, 56 insertions(+), 44 deletions(-) create mode 100644 docs/base.rst diff --git a/docs/base.rst b/docs/base.rst new file mode 100644 index 0000000..482d243 --- /dev/null +++ b/docs/base.rst @@ -0,0 +1,5 @@ +Base Response class +========================== + +.. autoclass:: yarn_api_client.base.Response + :members: data diff --git a/docs/index.rst b/docs/index.rst index 6c03c3c..ffd1c8d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,12 +9,13 @@ Welcome to yarn-api-client's documentation! Contents: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - resource_manager - node_manager - application_master - history_server + base + resource_manager + node_manager + application_master + history_server Indices and tables diff --git a/yarn_api_client/application_master.py b/yarn_api_client/application_master.py index 5c33d17..6f32939 100644 --- a/yarn_api_client/application_master.py +++ b/yarn_api_client/application_master.py @@ -19,8 +19,8 @@ class ApplicationMaster(BaseYarnAPI): :param int timeout: API connection timeout in seconds :param AuthBase auth: Auth to use for requests :param boolean verify: Either a boolean, in which case it controls whether - we verify the server's TLS certificate, or a string, in which case it must - be a path to a CA bundle to use. Defaults to ``True`` + we verify the server's TLS certificate, or a string, in which case it must + be a path to a CA bundle to use. Defaults to ``True`` """ def __init__(self, service_endpoint=None, timeout=30, auth=None, verify=True): if not service_endpoint: diff --git a/yarn_api_client/base.py b/yarn_api_client/base.py index ec23e3a..fab222e 100644 --- a/yarn_api_client/base.py +++ b/yarn_api_client/base.py @@ -13,7 +13,13 @@ class Response(object): + """ + Basic container for response dictionary + + :param requests.Response response: Response for call via requests lib + """ def __init__(self, response): + #: Dictionary with response data self.data = response.json() diff --git a/yarn_api_client/history_server.py b/yarn_api_client/history_server.py index cf10e1c..0a3b5c8 100644 --- a/yarn_api_client/history_server.py +++ b/yarn_api_client/history_server.py @@ -19,8 +19,8 @@ class HistoryServer(BaseYarnAPI): :param int timeout: API connection timeout in seconds :param AuthBase auth: Auth to use for requests :param boolean verify: Either a boolean, in which case it controls whether - we verify the server's TLS certificate, or a string, in which case it must - be a path to a CA bundle to use. Defaults to ``True`` + we verify the server's TLS certificate, or a string, in which case it must + be a path to a CA bundle to use. Defaults to ``True`` """ def __init__(self, service_endpoint=None, timeout=30, auth=None, verify=True): if not service_endpoint: diff --git a/yarn_api_client/node_manager.py b/yarn_api_client/node_manager.py index 2b46fe0..185f905 100644 --- a/yarn_api_client/node_manager.py +++ b/yarn_api_client/node_manager.py @@ -30,8 +30,8 @@ class NodeManager(BaseYarnAPI): :param int timeout: API connection timeout in seconds :param AuthBase auth: Auth to use for requests :param boolean verify: Either a boolean, in which case it controls whether - we verify the server's TLS certificate, or a string, in which case it must - be a path to a CA bundle to use. Defaults to ``True`` + we verify the server's TLS certificate, or a string, in which case it must + be a path to a CA bundle to use. Defaults to ``True`` """ def __init__(self, service_endpoint=None, timeout=30, auth=None, verify=True): if not service_endpoint: diff --git a/yarn_api_client/resource_manager.py b/yarn_api_client/resource_manager.py index d7bbe40..cd7fc03 100644 --- a/yarn_api_client/resource_manager.py +++ b/yarn_api_client/resource_manager.py @@ -63,12 +63,12 @@ class ResourceManager(BaseYarnAPI): be used. :param List[str] service_endpoints: List of ResourceManager HTTP(S) - addresses + addresses :param int timeout: API connection timeout in seconds :param AuthBase auth: Auth to use for requests configurations :param boolean verify: Either a boolean, in which case it controls whether - we verify the server's TLS certificate, or a string, in which case it must - be a path to a CA bundle to use. Defaults to ``True`` + we verify the server's TLS certificate, or a string, in which case it must + be a path to a CA bundle to use. Defaults to ``True`` """ def __init__(self, service_endpoints=None, timeout=30, auth=None, verify=True): active_service_endpoint = None @@ -305,8 +305,8 @@ def cluster_application_attempt_container_info(self, application_id, attempt_id, def cluster_application_state(self, application_id): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) With the application state API, you can obtain the current state of an application. @@ -322,8 +322,8 @@ def cluster_application_state(self, application_id): def cluster_application_kill(self, application_id): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) With the application kill API, you can kill an application that is not in FINISHED or FAILED state. @@ -377,8 +377,8 @@ def cluster_node(self, node_id): def cluster_submit_application(self, data): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) With the New Application API, you can obtain an application-id which can then be used as part of the Cluster Submit Applications API to @@ -398,8 +398,8 @@ def cluster_submit_application(self, data): def cluster_new_application(self): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) With the New Application API, you can obtain an application-id which can then be used as part of the Cluster Submit Applications API to @@ -415,8 +415,8 @@ def cluster_new_application(self): def cluster_get_application_queue(self, application_id): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) With the application queue API, you can query the queue of a submitted app @@ -431,8 +431,8 @@ def cluster_get_application_queue(self, application_id): def cluster_change_application_queue(self, application_id, queue): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) Move a running app to another queue using a PUT request specifying the target queue. @@ -458,8 +458,8 @@ def cluster_change_application_queue(self, application_id, queue): def cluster_get_application_priority(self, application_id): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) With the application priority API, you can query the priority of a submitted app @@ -474,8 +474,8 @@ def cluster_get_application_priority(self, application_id): def cluster_change_application_priority(self, application_id, priority): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) Update priority of a running or accepted app using a PUT request specifying the target priority. @@ -584,7 +584,7 @@ def cluster_reservations(self, queue=None, reservation_id=None, unspecified or invalid, this will default to 0. :param str end_time: reservations that start after this end-time will be listed. If unspecified or invalid, this will default to Long.MaxValue. - :param str include_resource_allocations : true or false. If true, the resource allocations + :param str include_resource_allocations: true or false. If true, the resource allocations of the reservation will be included in the response. If false, no resource allocations will be included in the response. This will default to false. :returns: API response object with JSON data @@ -606,8 +606,8 @@ def cluster_reservations(self, queue=None, reservation_id=None, def cluster_new_delegation_token(self, renewer): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) API to create delegation token. @@ -627,8 +627,8 @@ def cluster_new_delegation_token(self, renewer): def cluster_renew_delegation_token(self, delegation_token): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) API to renew delegation token. @@ -650,8 +650,8 @@ def cluster_renew_delegation_token(self, delegation_token): def cluster_cancel_delegation_token(self, delegation_token): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) API to cancel delegation token. @@ -671,8 +671,8 @@ def cluster_cancel_delegation_token(self, delegation_token): def cluster_new_reservation(self): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) Use the New Reservation API, to obtain a reservation-id which can then be used as part of the Cluster Reservation API Submit to submit reservations. @@ -764,7 +764,7 @@ def cluster_application_timeout(self, application_id, timeout_type): The Cluster Application Timeout resource contains information about timeout. :param str application_id: The application id - :param str timeout_type:Timeout type. Valid values are the members of the + :param str timeout_type: Timeout type. Valid values are the members of the ApplicationTimeoutType enum. LIFETIME is currently the only valid value. . :returns: API response object with JSON data :rtype: :py:class:`yarn_api_client.base.Response` @@ -794,8 +794,8 @@ def cluster_update_application_timeout(self, application_id, timeout_type, expir def cluster_scheduler_conf_mutation(self): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) API to retrieve the scheduler’s configuration that is currently loaded into scheduler’s context. @@ -809,8 +809,8 @@ def cluster_scheduler_conf_mutation(self): def cluster_modify_scheduler_conf_mutation(self, data): """ - * This feature is currently in the alpha stage and may change in the - future * + (This feature is currently in the alpha stage and may change in the + future) API to modify the scheduler configuration