...
Object | Description |
---|---|
jobChainHistory = new Packages.com.sos.jitl.checkrunhistory.JobChainHistory( spooler.delegate ) | object for use with jobs and job monitors that are implemented with Java or JavaScript |
Methods | |
jobChainHistoryInfo | retrieves the JobHistoryInformation object within the specified limits:
|
JobChainHistoryInformation Object
This object is returned by the JobCHainHistory object for a given job chain and provides a set of JobChainHistoryInformationEntry objects for the respective job runs.
- Completed means "has an end date"
- With error means "has a state that is an error state in the job chain"
jobChainHistory.getNumberOfCompleted() | The number of completed entries |
jobChainHistory.getNumberOfStarts() | The number of starts |
jobChainHistory.getNumberOfCompletedSuccessful() | The number of completed runs with a state that is not an error state |
jobChainHistory.getNumberOfCompletedWithError() | The number of completed runs with a state that is an error state |
jobChainHistory.getCount() | The number of entries |
JobChainHistoryInformation Object
This object is returned by the JobCHainHistory object for a given job chain and provides a set of JobChainHistoryInformationEntry objects for the respective job runs.
- Completed means "has an end date"
- With error means "has a state that is an error state in the job chain"
Object | Description |
---|---|
jobChainHistoryInfo = jobChainHistory.getChainJobInfo( jobchain, limit, timelimit ) | The JobChainHistoryInformation object is retrieved from the JobChainHistory object for a given job chain Please note that an |
Object | Description |
jobChainHistoryInfo = jobChainHistory.getChainJobInfo( jobchain, limit, timelimit ) | The JobChainHistoryInformation object is retrieved from the JobChainHistory object for a given job chain Please note that an order can be specified with the jobchain: jobchain(order_id) . |
Methods | Description |
Retrieve JobChainHistoryInformationEntry objects | |
JobSchedulerHistoryInfoEntry jobChainHistoryInfo.getRunning() | Get the JobSchedulerHistoryInfoEntry object for the current job chain run. |
JobSchedulerHistoryInfoEntry | Get the JobSchedulerHistoryInfoEntry object for the most recently started job chain run including running order and orders that completed successfully or failed with error. |
JobSchedulerHistoryInfoEntry | Get the JobSchedulerHistoryInfoEntry object for the most recently completed job chain run including orders that completed successfully or failed with error. |
JobSchedulerHistoryInfoEntry | Get the JobSchedulerHistoryInfoEntry object for the most recently successfully completed job chain run. |
JobSchedulerHistoryInfoEntry | Get the JobSchedulerHistoryInfoEntry object for the most recently completed job chain run that failed with error. |
Checks for any job runs in the period of the current day | |
boolean | Indicates that a job chain run started within the current period and applies to running job chains and completed job chain runs. |
boolean | Indicates that a job chain run started and completed within the current period and applies to job chain runs that completed successfully or failed with errror. |
boolean | Indicates that a job chain run started and completed successfully within the current period. |
boolean | Indicates that a job chain run started and completed with error within the current period. |
Checks for any job runs that completed today | |
boolean | Indicates that a job chain run completed in the current period and applies to job runs that completed successfully or failed with error. |
boolean | Indicates that a job chain run completed successfully within the current period. |
boolean | Indicates that a job chain run completed with error within the current period. |
Checks for any job runs that ended after a specific point in time | |
boolean | indicates that a job chain run completed after the given date |
boolean | indicates that a job chain run completed successfully after the given date |
boolean | indicates that a job chain run completed with error after the given date |
Checks for any job runs that started after a specific point in time | |
boolean | indicates that a job chain run started after the given date, the job might be completed or running |
boolean | indictes that a job chain run started after the given date and does not report any errors, the job might be completed or running |
boolean | indicates that a job chain run started after the given date and does report errors, the job might be completed or running |
...
- Download complete example file: check_job_chain_run_history.job.xml
Code Block | ||||
---|---|---|---|---|
| ||||
function spooler_process() { { // using the current job name and default limit var jobChainHistoryInfo = getjobChainHistoryInfoObject("test"); // using the current job chain name and defaultthe given limit // var jobChainHistoryInfo = getjobChainHistoryInfoObject( "test", 30 ); // using the currentgiven job chain name and default limit // var jobChainHistoryInfo = getjobChainHistoryInfoObject( "jobchain1" ); // using the given limitjob chain name and the given limit // var jobChainHistoryInfo = getjobChainHistoryInfoObject( "jobchain1", 3020 ); // using the given job chain name and a defaultgiven limitorder_id // var jobChainHistoryInfo = getjobChainHistoryInfoObject( "jobchain1(order_id)", 20 ); // using the given job chain name and the given limit reporting some info on job runs report( jobChainHistoryInfo.getLastCompleted() ); report( jobChainHistoryInfo.getRunning() ); report( jobChainHistoryInfo.getLastCompletedSuccessful() ); //report( var jobChainHistoryInfo = getjobChainHistoryInfoObject( "jobchain1", 20 jobChainHistoryInfo.getLastCompletedWithError() ); // usingreport on thecurrently givenrunning job chain name and a given order_id // var jobChainHistoryInfo = getjobChainHistoryInfoObject( "jobchain1(order_id)", 20 report( jobChainHistoryInfo.getLastExecution() ); // reporting some info on job runs spooler_log.info("isStartedToday: " + jobChainHistoryInfo.isStartedToday()); report(spooler_log.info("isStartedTodayCompletedSuccessful: " + jobChainHistoryInfo.getLastCompletedisStartedTodayCompletedSuccessful() ); spooler_log.info("isStartedTodayCompletedWithError: " + report( jobChainHistoryInfo.getRunningisStartedTodayCompletedWithError() ); report( jobChainHistoryInfo.getLastCompletedSuccessful() spooler_log.info("isStartedTodayCompleted: " + jobChainHistoryInfo.isStartedTodayCompleted()); report( jobChainHistoryInfo.getLastCompletedWithError() ); spooler_log.info("isCompletedToday: " + jobChainHistoryInfo.isCompletedToday()); // report on currently running job report(spooler_log.info("isCompletedTodaySuccessful: " + jobChainHistoryInfo.getLastExecutionisCompletedTodaySuccessful() ); spooler_log.info("isStartedTodayisCompletedTodayWithError: " + jobChainHistoryInfo.isStartedTodayisCompletedTodayWithError()); spooler_log.info("isStartedTodayCompletedSuccessfulendedAfter: " + jobChainHistoryInfo.isStartedTodayCompletedSuccessful(endedAfter("03:00:00")); spooler_log.info("isStartedTodayCompletedWithErrorendedWithErrorAfter: " + jobChainHistoryInfo.isStartedTodayCompletedWithError(endedWithErrorAfter("03:00:00")); spooler_log.info("isStartedTodayCompletedendedSuccessfulAfter: " + jobChainHistoryInfo.isStartedTodayCompleted(endedSuccessfulAfter("03:00:00")); spooler_log.info("isCompletedTodaystartedAfter: " + jobChainHistoryInfo.isCompletedToday(startedAfter("03:00:00")); spooler_log.info("isCompletedTodaySuccessfulstartedWithErrorAfter: " + jobChainHistoryInfo.isCompletedTodaySuccessful(startedWithErrorAfter("03:00:00")); spooler_log.info("isCompletedTodayWithErrorstartedSuccessfulAfter: " + jobChainHistoryInfo.isCompletedTodayWithError(startedSuccessfulAfter("03:00:00")); spooler_log.info("endedAfterisStartedToday: " + jobChainHistoryInfo.endedAfterqueryHistory("03:00:00isStartedToday")); spooler_log.info("endedWithErrorAfterisStartedTodayCompletedSuccessful: " + jobChainHistoryInfo.endedWithErrorAfterqueryHistory("03:00:00isStartedTodayCompletedSuccessful")); spooler_log.info("endedSuccessfulAfterisStartedTodayCompletedWithError: " + jobChainHistoryInfo.endedSuccessfulAfterqueryHistory("03:00:00isStartedTodayCompletedWithError")); spooler_log.info("startedAfterisStartedTodayCompleted: " + jobChainHistoryInfo.startedAfterqueryHistory("03:00:00isStartedTodayCompleted")); spooler_log.info("startedWithErrorAfterisCompletedToday: " + jobChainHistoryInfo.startedWithErrorAfter("03:00:00queryHistory("isCompletedToday")); spooler_log.info("startedSuccessfulAfterisCompletedTodaySuccessfully: " + jobChainHistoryInfo.startedSuccessfulAfterqueryHistory("03:00:00isCompletedTodaySuccessful")); spooler_log.info("isStartedTodayisCompletedTodayWithError:" + jobChainHistoryInfo.queryHistory("isStartedTodayisCompletedTodayWithError ")); //since 1.10.2 1.9.8 also possible spooler_log.info("isStartedTodayCompletedSuccessfulisCompletedAfter:" + jobChainHistoryInfo.queryHistory("isStartedTodayCompletedSuccessfulisCompletedAfter(-1:10:48:33)")); spooler_log.info("isStartedTodayCompletedWithErrorisCompletedWithErrorAfter:" + jobChainHistoryInfo.queryHistory("isStartedTodayCompletedWithErrorisCompletedWithErrorAfter(03:00:00)")); spooler_log.info("isStartedTodayCompletedisCompletedSuccessfulAfter:" + jobChainHistoryInfo.queryHistory("isStartedTodayCompletedisCompletedSuccessfulAfter(03:00:00)")); spooler_log.info("isCompletedTodayisStartedAfter:" + jobChainHistoryInfo.queryHistory("isCompletedTodayisStartedAfter(-1:10:48:33)")); spooler_log.info("isCompletedTodaySuccessfullyisStartedWithErrorAfter:" + jobChainHistoryInfo.queryHistory("isCompletedTodaySuccessfulisStartedWithErrorAfter(03:00:00)")); spooler_log.info("isCompletedTodayWithErrorisStartedSuccessfulAfter:" + jobChainHistoryInfo.queryHistory("isCompletedTodayWithError isStartedSuccessfulAfter(03:00:00)")); // example how to convert Date fields (start date) //since 1.10.2 1.9.8 also possibleif ( jobChainHistoryInfo.getLastCompletedSuccessful().found ) { spooler_log.info("isCompletedAfter:" + var d = jobChainHistoryInfo.queryHistory("isCompletedAfter(-1:10:48:33)"))getLastCompletedSuccessful().start; spooler_log.info("isCompletedWithErrorAfter:" + jobChainHistoryInfo.queryHistory("isCompletedWithErrorAfter(03:00:00)")); if (d != null) { spooler_log.info("isCompletedSuccessfulAfter:" + jobChainHistoryInfo.queryHistory("isCompletedSuccessfulAfter(03:00:00)")); spooler_log.info("isStartedAfter:" + jobChainHistoryInfo.queryHistory("isStartedAfter(-1:10:48:33)"))var d2 = new Date(d.getTime()); spooler_log.info("isStartedWithErrorAfter:" + jobChainHistoryInfo.queryHistory("isStartedWithErrorAfter(03:00:00)")); spooler_log.info ("isStartedSuccessfulAfter:------->" + jobChainHistoryInfod2.queryHistory("isStartedSuccessfulAfter(03:00:00)")); getFullYear() ); // example how to convert} Date fields (start date) if ( jobChainHistoryInfo.getLastCompletedSuccessful().found ) { var d = jobChainHistoryInfo.getLastCompletedSuccessful().start; if (d != null) { var d2 = new Date(d.getTime())} spooler_log.info ( "check if the job chain started on the previous day before a specific point in time" ); var jobChainHistoryInfo = getjobChainHistoryInfoObject( "jobchain1", "", "-1:10:43:56" ); spooler_log.info ( "------->completedBefore -1:10:43:56: " + d2jobChainHistoryInfo.getFullYearisCompletedBefore() ); spooler_log.info ( "completedWithErrorBefore -1:10:43:56: " } } + jobChainHistoryInfo.isCompletedWithErrorBefore() ); spooler_log.info ( "check if the job chain started on the previous day before a specific point in time" ); var jobChainHistoryInfo = getjobChainHistoryInfoObject( "jobchain1", "", "-1:10:43:56" );completedSuccessfulBefore -1:10:43:56: " + jobChainHistoryInfo.isCompletedSuccessfulBefore() ); //since 1.10.2 1.9.8 also possible spooler_log.info ( "completedBefore -1:10:43:56: " + jobChainHistoryInfo.queryHistory("isCompletedBefore(")); spooler_log.info ( "completedWithErrorBefore -1:10:43:56: " + jobChainHistoryInfo.queryHistory("isCompletedWithErrorBefore(") ); spooler_log.info ( "completedSuccessfulBefore -1:10:43:56: " + jobChainHistoryInfo.queryHistory("isCompletedSuccessfulBefore(") ); //since 1.10.2 1.9.8 also possible spooler_log.info ( "completedBefore -1:10:43:56: " + jobChainHistoryInfo.queryHistory("isCompletedBefore")); spooler_log.info ( "completedWithErrorBefore -1:10:43:56: " + jobChainHistoryInfo.queryHistory("isCompletedWithErrorBefore")); spooler_log.info ( "completedSuccessfulBefore -1:10:43:56: " + jobChainHistoryInfo.queryHistory("isCompletedSuccessfulBefore")); return false; } function getjobChainHistoryInfoObject(jobchain, limit, timelimitreturn false; } function getjobChainHistoryInfoObject(jobchain, limit, timelimit) { var jobChainHistory = new Packages.com.sos.jitl.checkrunhistory.JobChainHistory( spooler.delegate ); if ((jobchain === undefined) || (jobchain === "")) { jobchain = spooler_task.order.job_chain.name; } if (limit === undefined || limit === "") { var jobChainHistory = new Packages.com.sos.jitl.checkrunhistory.JobChainHistory( spooler.delegate ); limit = "100"; if} ((jobchain === undefined) ||if (jobchaintimelimit === "")undefined) { jobchain timelimit = spooler_task.order.job_chain.name""; } if (limit === undefined || limit === "") {var jobChainHistoryInfo = jobChainHistory.getJobChainInfo( jobchain, limit, timelimit ); spooler_log.info("Number of completed: " + jobChainHistory.getNumberOfCompleted()); spooler_log.info("Number of starts: limit" = "100"+ jobChainHistory.getNumberOfStarts()); } if (timelimit === undefined) {spooler_log.info("Number of completed successfull: " + jobChainHistory.getNumberOfCompletedSuccessful()); spooler_log.info("Number of completed timelimitwith =error: "" + jobChainHistory.getNumberOfCompletedWithError()); } var jobChainHistoryInfo =spooler_log.info("Number of entries: " + jobChainHistory.getJobChainInfo( jobchain, limit, timelimit getCount()); return return jobChainHistoryInfo; } function report( reportItem ) { spooler_log.info( "_____________________________" ); if (reportItem.found) { spooler_log.info( "Name:" + reportItem.name ); spooler_log.info( "id: " + reportItem.id ); spooler_log.info( "Job chain name: " + reportItem.jobChainName ); spooler_log.info( "Position: " + reportItem.position ); spooler_log.info( "Start Time: " + reportItem.start ); spooler_log.info( "End Time: " + reportItem.end ); spooler_log.info( "Duration: " + reportItem.duration ); spooler_log.info( "Error: " + reportItem.error ); } else { spooler_log.info( "Name: " + reportItem.name + " not found" ); } } |
...