GithubHelp home page GithubHelp logo

isabella232 / hadoop-jobtracker-rest Goto Github PK

View Code? Open in Web Editor NEW

This project forked from forward3d/hadoop-jobtracker-rest

0.0 0.0 0.0 110 KB

Presents information from Hadoop's MR1 JobTracker in a RESTful JSON way

Ruby 100.00%

hadoop-jobtracker-rest's Introduction

Hadoop JobTracker REST interface

This a very simple JRuby Sinatra app that talks to the Hadoop MR1 JobTracker via the Hadoop Java libraries, and exposes a list of jobs in JSON format for easy consumption.

Requirements

JRuby Maven (for jbundler)

Instructions

First run bundler to get jbundler:

bundle install

Now run jbundler:

jbundle install

You need to configure the hostname and port your jobtracker runs on; edit config/config.yml to set this.

Now start the app:

jbundle exec ./app.rb

API description

There's only three implemented endpoints:

Get a list of all jobs the jobtracker knows about

$ curl -sX GET localhost:4567/jobs/all | python -mjson.tool
[
  {
      "job_id": "job_201307151313_0003",
      "job_name": "bananas",
      "priority": "NORMAL",
      "start_time": 1374154944193,
      "status": "SUCCEEDED"
  },
  {
      "job_id": "job_201307151313_0004",
      "job_name": "bananas",
      "priority": "NORMAL",
      "start_time": 1374154974307,
      "status": "SUCCEEDED"
  },
  {
      "job_id": "job_201307151313_0005",
      "job_name": "bananas",
      "priority": "NORMAL",
      "start_time": 1374155109432,
      "status": "SUCCEEDED"
  },
  {
      "job_id": "job_201307151313_0006",
      "job_name": "bananas",
      "priority": "NORMAL",
      "start_time": 1374155304857,
      "status": "KILLED"
  }
]

Get a list of all the running jobs

$ curl -sX GET localhost:4567/jobs/running | python -mjson.tool
[
  {
      "job_id": "job_201307151313_0007",
      "job_name": "bananas",
      "map_progress": 1.0,
      "priority": "NORMAL",
      "reduce_progress": 0.0
  }
] 

map_progress and reduce_progress will be a number between 0.0 and 1.0 (0% to 100%). It's not always updated particularly quickly.

Kill a running job

You need to supply the job_name of the job you want to kill.

$ curl -sX DELETE localhost:4567/jobs/bananas | python -mjson.tool
{"message": "job killed"}

If the job can't be found, you'll get a 404, and this output:

$ curl -sX DELETE localhost:4567/jobs/bananas | python -mjson.tool
{"error": "job not found"}

After sending a job a kill message, it won't immediately exit, and will continue to be displayed in the jobtracker for a few seconds while it gets cleaned up.

Improvements

  • be able to kill a job by job ID
  • try to figure out some way to get more information about jobs (job conf); the API docs are super unhelpful on this front
  • get/list counters for the job
  • provide some information about available mappers/reducers, cluster stats, etc.

Pull requests welcomed!

hadoop-jobtracker-rest's People

Contributors

andytinycat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.