<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">

<document>
  <header>
    <title>GET queue/:jobid </title>
  </header>

  <body>
  <section>
   <title>Description</title>
    <p>Check the status of a job and get related job information given its job ID.
     Substitute ":jobid" with the job ID received when the job was created.</p>
  </section>

  <section>
   <title>URL</title>
    <p><code>http://</code>www.myserver.com<code>/templeton/v1/queue/</code>:jobid<code></code></p>
  </section>

  <section>
   <title>Parameters</title>
    <table>
    <tr><th>Name</th><th>Description</th><th>Required?</th><th>Default</th></tr>

    <tr><td><strong>:jobid</strong></td>
        <td>The job ID to check. This is the ID received when the
         job was created.</td>
        <td>Required</td>
        <td>None</td>
    </tr>
    </table>
  </section>

  <section>
   <title>Results</title>
    <table>
    <tr><th>Name</th><th>Description</th></tr>
    <tr><td><strong>status</strong></td>
        <td>A JSON object containing the job status information.
            See the Hadoop documentation
            (<a href="http://hadoop.apache.org/common/docs/stable/api/org/apache/hadoop/mapred/JobStatus.html">Class
            JobStatus</a>) for more information.</td>
    </tr>

    <tr><td><strong>profile</strong></td>
        <td>A JSON object containing the job profile information.
             See the Hadoop documentation
            (<a href="http://hadoop.apache.org/common/docs/stable/api/org/apache/hadoop/mapred/JobProfile.html">Class
            JobProfile</a>) for more information.
</td>
    </tr>

    <tr><td><strong>id</strong></td>
        <td>The job ID.</td>
    </tr>

    <tr><td><strong>parentId</strong></td>
        <td>The parent job ID.</td>
    </tr>

    <tr><td><strong>percentComplete</strong></td>
        <td>The job completion percentage, for example "75% complete".</td>
    </tr>

    <tr><td><strong>exitValue</strong></td>
        <td>The job's exit value.</td>
    </tr>

    <tr><td><strong>user</strong></td>
        <td>User name of the job creator.</td>
    </tr>

    <tr><td><strong>callback</strong></td>
        <td>The callback URL, if any.</td>
    </tr>

    <tr><td><strong>completed</strong></td>
        <td>A string representing completed status, for example "done".</td>
    </tr>

    </table>
 </section>

  <section>
   <title>Example</title>

   <p><strong>Curl Command</strong></p>
<source>
% curl -s 'http://localhost:50111/templeton/v1/queue/job_201112212038_0003?user.name=ctdean'
</source>

   <p><strong>JSON Output</strong></p>
<source>
{
 "status": {
            "startTime": 1324529476131,
            "username": "ctdean",
            "jobID": {
                      "jtIdentifier": "201112212038",
                      "id": 4
                     },
            "jobACLs": {
                       },
            "schedulingInfo": "NA",
            "failureInfo": "NA",
            "jobId": "job_201112212038_0004",
            "jobPriority": "NORMAL",
            "runState": 2,
            "jobComplete": true
           },
 "profile": {
             "url": "http://localhost:50030/jobdetails.jsp?jobid=job_201112212038_0004",
             "jobID": {
                       "jtIdentifier": "201112212038",
                        "id": 4
                      },
             "user": "ctdean",
             "queueName": "default",
             "jobFile": "hdfs://localhost:9000/tmp/hadoop-ctdean/mapred/staging/ctdean/.staging/job_201112212038_0004/job.xml",
             "jobName": "PigLatin:DefaultJobName",
             "jobId": "job_201112212038_0004"
            },
 "id": "job_201112212038_0004",
 "parentId": "job_201112212038_0003",
 "percentComplete": "100% complete",
 "exitValue": 0,
 "user": "ctdean",
 "callback": null,
 "completed": "done",
 "userargs" => {
   "callback"  => null,
   "define"    => [],
   "enablelog" => "false",
   "execute"   => "select a,rand(b) from mynums",
   "file"      => null,
   "files"     => [],
   "statusdir" => null,
   "user.name" => "hadoopqa",
 },
}
</source>
  </section>
 </body>
</document>
