Javascript interface to Oozie hadoop scheduler.


Keywords
oozie, scheduler, hadoop
License
ISC
Install
npm install oozie@0.2.3-beta

Documentation

Development status

Still in testing, not ready for production

Usage

  var Oozie = require('./index.js');

  var wfconfig = {
    // name: '${wfName}',
    // startTo: 'terserah-biasanya-ada-node',  // ini node action, bisa dikosongkan.
    endName: 'end',
    killName: 'fail',
    killMessage: 'Workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}]',  // pesan error ketika gagal.
    action: {
      // name: 'terserah-biasanya-ada-node',  // action name bisa dikosongkan.
      java: {                             // ini kalau action ini menjalankan aplikasi java, selain java belum
        'job-tracker': '${jobTracker}',   // property yang ada di dalam java harus lengkap, minimal seperti ini.
        'name-node': '${nameNode}',
        configuration: {
          property: [{
            name: 'mapred.job.queue.name',
            value: '${queueName}'
          }]
        },
        'main-class': '${classname}',
        'java-opts': [],
        arg: [
          '/user/apps/asep/testin.txt',
          '/user/apps/asep/output'
        ],
        // file: 'file.jar'  // lokasi jar didefinisikan saat new oozie.
      }
    }
  };

  var config = {
    node: {
      hdfs: {
        protocol: 'http',
        hostname: '192.168.1.225',
        port: 50070,
        user: 'apps',
        overwrite: true
      },
      jobTracker: {
        protocol: 'http',
        hostname: '192.168.1.225',
        port: 8032
      },
      nameNode: {
        hostname: '192.168.1.225',
        port: 8020
      },
      oozie: {
        protocol: 'http',
        hostname: '192.168.1.225',
        port: 11000,
        user: 'apps'
      }
    },
    libpath: '/user/apps/lib/247',
    queueName: 'root.default',
    artefact: {
      jar: '/user/apps/oozie-artefact/jar/',
      workflow: '/user/apps/oozie-artefact/workflow/'
    }
  };

  var oozie = new Oozie(config);

  oozie.on('ready', function () {
    oozie.submit('java', null, 'casetwo.jar', 'dummy.casetwo', [], [{
      name: 'namajar',
      value: 'casetwo.jar'
    }], wfconfig);

    oozie.on('jobSubmitted', function () {
      console.log(subject01.jobid);
    });
  });

Functions

Oozie(config)

Oozie class constructor

defaultResponse(e, r, b)

Response default for start, rerun, get.

Oozie(config)

Oozie class constructor

Kind: global function

Param Type Description
config Object Config object.

oozie.setName(name)

Set name of running job.

Kind: instance method of Oozie

Param Type Description
name String Name of job

oozie.getName() ⇒ String

get name of job.

Kind: instance method of Oozie
Returns: String - job name

oozie.setProperty(property)

Set private property

Kind: instance method of Oozie

Param Type Description
property Object Property to be set.

oozie.genwf(arg, wfconfig, cb)

Generate oozie workflow-app

Kind: instance method of Oozie

Param Type Description
arg Array Job workflow arguments
wfconfig Object Full workflow config
cb function Callback function

oozie.getDefaultProperty() ⇒ Object

Get default property

Kind: instance method of Oozie
Returns: Object - Default property object.

oozie.getDefaultWorkflow() ⇒ Object

Get default workflow

Kind: instance method of Oozie
Returns: Object - Default workflow object.

oozie.submit(type, name, jobfile, className, arg, prop, wfconfig, cb)

submit job to oozie

Kind: instance method of Oozie

Param Type Description
type String Type of submitted job
name String Name of job, set to random if null
jobfile String Name of file, only name without path, path have been set on constructor.
className String Class path of job.
arg Array Array of job arguments, set empty array to set no argument.
prop Array Array of object properties, this array will be concatenated to default properties, set empty array if using default properties only.
wfconfig Object Object of custom workflow config
cb function Callback function.

oozie.start(jobid)

Start Job

Kind: instance method of Oozie

Param Type Description
jobid String Job ID to be Start.

oozie.rerun(jobid)

Re running job, identified by jobid.

Kind: instance method of Oozie

Param Type Description
jobid String Job id that needed to run.

oozie.get(jobid)

Get job info identified by jobId.

Kind: instance method of Oozie

Param Type Description
jobid String Job Id that needed to get.

defaultResponse(e, r, b)

Response default for start, rerun, get.

Kind: global function

Param Type Description
e Object Error Object from request.
r Object Response Object from request.
b Mixed Response body from request.