0.3.1-beta.6 • Published 7 years ago

oozie v0.3.1-beta.6

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

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, function () {}, false);

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

Functions

Oozie(config)

Oozie class constructor

Kind: global function

ParamTypeDescription
configObjectConfig object.

oozie.setName(name)

Set name of running job.

Kind: instance method of Oozie

ParamTypeDescription
nameStringName 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

ParamTypeDescription
propertyObjectProperty to be set.

oozie.genwf(arg, wfconfig, cb)

Generate oozie workflow-app

Kind: instance method of Oozie

ParamTypeDescription
argArrayJob workflow arguments
wfconfigObjectFull workflow config
cbfunctionCallback function

oozie.gencoord(coordconfig, cb)

Generate oozie coordinator-app

Kind: instance method of Oozie

ParamTypeDescription
coordconfigObjectFull coordinator config
cbfunctionCallback 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, start, cb)

submit job to oozie

Kind: instance method of Oozie

ParamTypeDescription
typeStringType of submitted job
nameStringName of job, set to random if null
jobfileStringName of file, only name without path, path have been set on constructor.
classNameStringClass path of job.
argArrayArray of job arguments, set empty array to set no argument.
propArrayArray of object properties, this array will be concatenated to default properties, set empty array if using default properties only.
wfconfigObjectObject of custom workflow config
startBooleanStart job immediately after submitted
cbfunctionCallback function.

oozie.submitcoord(name, prop, coordconfig, cb)

submit coordinator to oozie

Kind: instance method of Oozie

ParamTypeDescription
nameStringName of job, set to random if null
propArrayArray of object properties, this array will be concatenated to default properties, set empty array if using default properties only.
coordconfigObjectObject of custom workflow config
cbfunctionCallback function.

oozie.start(jobid)

Start Job

Kind: instance method of Oozie

ParamTypeDescription
jobidStringJob ID to be Start.

oozie.kill(jobid)

Kill Job

Kind: instance method of Oozie

ParamTypeDescription
jobidStringJob ID to be Killed.

oozie.suspend(jobid)

Suspend Job

Kind: instance method of Oozie

ParamTypeDescription
jobidStringJob ID to be Suspended.

oozie.resume(jobid)

Resume Job

Kind: instance method of Oozie

ParamTypeDescription
jobidStringJob ID to be Resumed.

oozie.rerun(jobid)

Re running job, identified by jobid.

Kind: instance method of Oozie

ParamTypeDescription
jobidStringJob id that needed to run.

oozie.get(jobid)

Get job info identified by jobId.

Kind: instance method of Oozie

ParamTypeDescription
jobidStringJob Id that needed to get.

defaultResponse(e, r, b)

Response default for start, rerun, get.

Kind: global function

ParamTypeDescription
eObjectError Object from request.
rObjectResponse Object from request.
bMixedResponse body from request.