nl_tokens: Get all the jobs : - params - JSON Object . Can include the value of the job s execution status and any other key / value pair to search for into job sparams . - execution - String the execution status for the jobs to return . Return all jobs if no execution status is given . - callback - f ( err jobs )
pl_tokens: function getJobs ( params , callback ) { var executions = [ 'queued' , 'failed' , 'succeeded' , 'canceled' , 'running' , 'retried' , 'waiting' ] ; var execution ; var offset ; var <mask> ; var rJobs = [ ] ; var theJobs = [ ] ; if ( typeof ( params ) === 'object' ) { execution = params . execution ; delete params . execution ; offset = params . offset ; delete params . offset ; limit = params . limit ; delete params . limit ; } if ( typeof ( params ) === 'function' ) { callback = params ; params = { } ; } if ( ( typeof ( execution ) !== 'undefined' ) && ( executions . indexOf ( execution ) === - 1 ) ) { return callback ( new e . BackendInvalidArgumentError ( 'excution is required and must be one of "' + executions . join ( '", "' ) + '"' ) ) ; } if ( typeof ( execution ) !== 'undefined' ) { rJobs = Object . keys ( jobs ) . filter ( function ( uuid ) { return ( jobs [ uuid ] . execution === execution ) ; } ) . map ( function ( uuid ) { return clone ( jobs [ uuid ] ) ; } ) ; } else { rJobs = Object . keys ( jobs ) . map ( function ( uuid ) { return clone ( jobs [ uuid ] ) ; } ) ; } rJobs . forEach ( function ( job ) { if ( hasPropsAndVals ( job . params , params ) ) { theJobs . push ( job ) ; } } ) ; if ( typeof ( offset ) !== 'undefined' && typeof ( limit ) !== 'undefined' ) { return callback ( null , theJobs . slice ( offset , limit ) ) ; } else { return callback ( null , theJobs ) ; } }