ResourceManager API’s.

class yarn_api_client.resource_manager.ResourceManager(address=None, port=8088, timeout=30, kerberos_enabled=False)

The ResourceManager REST API’s allow the user to get information about the 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.

Parameters:
  • address (str) – ResourceManager HTTP address
  • port (int) – ResourceManager HTTP port
  • timeout (int) – API connection timeout in seconds
  • kerberos_enabled (boolean) – Flag identifying is Kerberos Security has been enabled for YARN
cluster_application(application_id)

An application resource contains information about a particular application that was submitted to a cluster.

Parameters:application_id (str) – The application id
Returns:API response object with JSON data
Return type:yarn_api_client.base.Response
cluster_application_attempt_containers(application_id, attempt_id)

With the application attempts API, you can obtain an information about container related to an application attempt.

Parameters:
  • application_id (str) – The application id
  • attempt_id (str) – The attempt id
Returns:

API response object with JSON data

Return type:

yarn_api_client.base.Response

cluster_application_attempt_info(application_id, attempt_id)

With the application attempts API, you can obtain an extended info about an application attempt.

Parameters:
  • application_id (str) – The application id
  • attempt_id (str) – The attempt id
Returns:

API response object with JSON data

Return type:

yarn_api_client.base.Response

cluster_application_attempts(application_id)

With the application attempts API, you can obtain a collection of resources that represent an application attempt.

Parameters:application_id (str) – The application id
Returns:API response object with JSON data
Return type:yarn_api_client.base.Response
cluster_application_kill(application_id)

With the application kill API, you can kill an application that is not in FINISHED or FAILED state.

Parameters:application_id (str) – The application id
Returns:API response object with JSON data
Return type:yarn_api_client.base.Response
cluster_application_state(application_id)

With the application state API, you can obtain the current state of an application.

Parameters:application_id (str) – The application id
Returns:API response object with JSON data
Return type:yarn_api_client.base.Response
cluster_application_statistics(state_list=None, application_type_list=None)

With the Application Statistics API, you can obtain a collection of triples, each of which contains the application type, the application state and the number of applications of this type and this state in ResourceManager context.

This method work in Hadoop > 2.0.0

Parameters:
  • state_list (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.
  • application_type_list (list) – types of the applications, specified as a comma-separated list. If application_types 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

Return type:

yarn_api_client.base.Response

cluster_applications(state=None, final_status=None, user=None, queue=None, limit=None, started_time_begin=None, started_time_end=None, finished_time_begin=None, finished_time_end=None)

With the Applications API, you can obtain a collection of resources, each of which represents an application.

Parameters:
  • state (str) – state of the application
  • final_status (str) – the final status of the application - reported by the application itself
  • user (str) – user name
  • queue (str) – queue name
  • limit (str) – total number of app objects to be returned
  • started_time_begin (str) – applications with start time beginning with this time, specified in ms since epoch
  • started_time_end (str) – applications with start time ending with this time, specified in ms since epoch
  • finished_time_begin (str) – applications with finish time beginning with this time, specified in ms since epoch
  • finished_time_end (str) – applications with finish time ending with this time, specified in ms since epoch
Returns:

API response object with JSON data

Return type:

yarn_api_client.base.Response

Raises:

yarn_api_client.errors.IllegalArgumentError – if state or final_status incorrect

cluster_information()

The cluster information resource provides overall information about the cluster.

Returns:API response object with JSON data
Return type:yarn_api_client.base.Response
cluster_metrics()

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
Return type:yarn_api_client.base.Response
cluster_node(node_id)

A node resource contains information about a node in the cluster.

Parameters:node_id (str) – The node id
Returns:API response object with JSON data
Return type:yarn_api_client.base.Response
cluster_nodes(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
Return type:yarn_api_client.base.Response
Raises:yarn_api_client.errors.IllegalArgumentError – if healthy incorrect
cluster_scheduler()

A scheduler resource contains information about the current scheduler configured in a cluster. It currently supports both the Fifo and 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
Return type:yarn_api_client.base.Response