Skip to main content

Python wrapper for Hadoop YARN REST API

Project description

This is Python Library for Hadoop YARN REST api.

This project follows the [Hadoop YARN REST Api](https://hadoop.apache.org/docs/current/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html) document.

We have implemented the following APIs.

  • Cluster Information API

  • Cluster Metrics API

  • Cluster Scheduler API

  • Cluster Applications API

  • Cluster Application Statistics API

  • Cluster Application API

  • Cluster Application Attempts API

  • Cluster Nodes API

  • Cluster Node API

Usage

Install it:

pip install hadoop-yarn-rest-api

Usage:

from hadoop.yarn import Yarn
import xml.etree.ElementTree as ET
import json
import xml.dom.minidom

def main():
    yarn = Yarn("http://localhost:8088", 'json')

    response_obj = yarn.cluster_information()
    response_obj = yarn.cluster_metrics()
    response_obj = yarn.cluster_scheduler()
    response_obj = yarn.cluster_applications()
    response_obj = yarn.cluster_applications({"limit":100})
    response_obj = yarn.cluster_appstatistics()
    response_obj = yarn.cluster_appstatistics({"states":"accepted,running,finished","applicationTypes":"mapreduce"})
    response_obj = yarn.cluster_application("job_id")
    response_obj = yarn.cluster_application_attempts("job_id")
    response_obj = yarn.cluster_nodes()
    response_obj = yarn.cluster_nodes({"states":"RUNNING"})  # NEW, RUNNING, UNHEALTHY, DECOMMISSIONING, DECOMMISSIONED, LOST, REBOOTED, SHUTDOWN
    response_obj = yarn.cluster_node("node_id")

    if yarn.response_type == 'json':
        print(json.dumps(response_obj, indent=4, sort_keys=True))
    elif yarn.response_type == 'xml':
        print(xml.dom.minidom.parseString(ET.tostring(response_obj)).toprettyxml())
    else:
        print(response_obj)

if __name__ == '__main__':
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

hadoop_yarn_rest_api-1.1.0-py2.py3-none-any.whl (6.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file hadoop_yarn_rest_api-1.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: hadoop_yarn_rest_api-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for hadoop_yarn_rest_api-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 088054da6330ee93cdd3a6a1cbf99df8acfa04e52a794f8f1407e5e85707b3b0
MD5 19f48e20017ac3428d5249d207b59289
BLAKE2b-256 bf8fc1126ad72d8a45274ab04f62c0543ec7fad8d7b8526bc2aa23ec2cfe7886

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page