-
Notifications
You must be signed in to change notification settings - Fork 6
ow.oJob
- oJob.__addLog
- oJob.addTodos
- oJob.getID
- oJob.load
- oJob.oJob
- oJob.removeJob
- oJob.setJob
- oJob.start
- oJob.stop
- ow.oJob.addJob
- ow.oJob.addTodo
- ow.oJob.getJobsCh
- ow.oJob.getLogCh
- ow.oJob.getMainCh
- ow.oJob.getTodoCh
- ow.oJob.loadFile
- ow.oJob.loadJSON
- ow.oJob.previewFile
- ow.oJob.run
- ow.oJob.runFile
- ow.oJob.runJob
oJob.__addLog(aOperation, aJobName, aJobExecId, anErrorMessage) : String
Adds a new log entry to the channel oJob::log for the aJobName provided for the following operations:
- start (start of a job)
- success (successfully end of a job)
- error (erroneous end of a job)
- depsfail (job not started do to failed dependencies)
Optionally, for the operation error, you can provide also anErrorMessage.
Returns the current aJobExecId (or the created one for the operation start).
oJob.addTodos(aTodoList, aId) : oJob
Adds a new aTodoList array of job names. Optionally you can provide aId to segment these specific jobs.
oJob.getID() : String
Returns this oJob instance ID. Useful to lookup logging in the oJob::log channel.
oJob.load(aJobsList, aTodoList, aoJobList, args, aId)
Loads a set of aJobsList, corresponding aTodoList and a list of aoJobList. Optionally you can provide aId to segment these specific jobs.
oJob.oJob() : oJob
Creates an instance of an oJob. O Uses the channel oJob::log for job logging, oJob::jobs for job register, oJob::todo as job todo register and oJob::oJob for oJob instances registry.
oJob.removeJob(aJobName) : oJob
Removes aJobName.
oJob.setJob(aJobName, aJob) : oJob
Adds or overwrites an existing aJobName with the configuration aJob.
oJob.start(args, shouldStop, aId) : oJob
Starts the todo list. Optionally you can provide arguments to be used by each job. Optionally you can provide aId to segment these specific jobs.
oJob.stop()
Stops all oJob processing.
ow.oJob.addJob(aJobsCh, aName, jobDeps, jobType, aJobTypeArgs, jobArgs, jobFunc, jobFrom, jobTo, jobHelp)
Provided aJobsCh (a jobs channel) adds a new job with the provided aName, an array of jobDeps (job dependencies), a jobType (e.g. single, peoridic, shutdown), aJobTypeArgs (a map), jobArgs and a jobFunc (a job function). Optionally you can inherit the job definition from a jobFrom and/or jobTo name ("from" will execute first, "to" will execute after). Also you can include jobHelp.
ow.oJob.addTodo(aOJobID, aJobsCh, aTodoCh, aJobName, aJogArgs, aJobType, aJobTypeArgs)
Provided aOJobID (a oJob instance), aJobsCh (a jobs channel), aTodoCh (a todo channel), aJobArgs (job arguments). Optionally you can force the aJobType and aJobTypeArgs.
ow.oJob.getJobsCh() : Channel
Gets the oJob::jobs channel
ow.oJob.getLogCh() : Channel
Gets the oJob::log channel
ow.oJob.getMainCh() : Channel
Gets the oJob::oJob channel
ow.oJob.getTodoCh() : Channel
Gets the oJob::todo channel
ow.oJob.loadFile(aFile, aId)
Loads the configuration from a YAML or JSON aFile and loads all configuration.
Optionally you can provide aId to segment these specific jobs.
Example of YAML:
#
include:
- hello.js # Some nice hello function
jobs:
# Start processing
- name : Start processing
exec : >
log("init");
//sprint(ow.oJob.getJobsCh().getAll());
- name : Stop processing
type : shutdown
exec : >
log("done");
sprint(ow.oJob.getLogCh().getAll());
- name : Hello world
deps :
- Start processing
exec : >
sprint(args);
hello("nuno");
- name : Bye
deps :
- Hello world
- Say the time
exec :
print("bye, nice to meet you.");
- name : Say the time
type : periodic
typeArgs :
timeInterval : 1000
waitForFinish : true
cron : "*/5 * * * * *"
exec : >
print(new Date());
todo:
- Start processing
- Say the time
- Hello world
- Bye
- Stop processing
ojob:
daemon: false
unique:
pidFile : helloworld.pid
killPrevious: true
channels:
: true
port : 17878
permissions: r
#list :
# - oJob::log
#auth :
# - login: ojob
# pass : ojob
# permissions: r
ow.oJob.loadJSON(aJSON) : Object
Loads aJSON oJob configuration and returns the processed map (with all includes processed).
ow.oJob.previewFile(aFile) : Map
Returns a map with a preview of the oJob configuration that would be executed with aFile.
ow.oJob.run(providedArgs, aId)
Tries to run the current loaded configuration jobs (on the corresponding channels) with the provided arguments (providedArgs). Optionally you can provide aId to segment these specific jobs.
ow.oJob.runFile(aFile, args, aId)
Loads aFile configuration and executes the oJob defined with the provided args. Optionally you can provide aId to segment these specific jobs.
ow.oJob.runJob(aJob, provideArgs, aId)
With jobs defined try to execute/start aJob, with the provideArgs, directly passing any existing todo list. Optionally you can provide aId to segment this specific jobs.