Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Users would like to check in individual job scripts or monitor scripts
    • if a job has been executed in the current period, e.g. for the current day
    • what execution result (success/failure) was created on completion of the job
  • The intention for checking the job execution history is to automate decision making based on the point in time or execution result of a previous job start.

Feature

  • Display feature availability
    StartingFromRelease1.10.2
  • This feature 
    • is available with
      Jira
      serverSOS JIRA
      columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
      serverId6dc67751-9d67-34cd-985b-194a8cdc9602
      keyJITL-217
    • is a subset of
      Jira
      serverSOS JIRA
      columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
      serverId6dc67751-9d67-34cd-985b-194a8cdc9602
      keyJITL-212
  • A JobHistory object is provided for job history checks that can be used
    • in individual jobs that are implemented with Java or JavaScript.
    • in individual job monitors that are implemented with Java or JavaScript.
  • The JobHistory object returns a JobHistoryInformation object for a given job that contains the history of the job runs.
  • The JobHistoryInformation object provides a set of JobHistoryInformationEntry objects that expose the history information for the respective job runs.

...

Checks for any job runs that started after a specific point in time
ObjectDescription
jobHistoryInfo = jobHistory.getJobInfo( jobname, limit, timelimit )
The JobHistoryInformation object is retrieved from the JobHistory object for a given job.
Methods Description
Retrieve JobHistoryInformationEntry objects
JobSchedulerHistoryInfoEntry jobHistoryInfo.getRunning()Get the JobSchedulerHistoryInfoEntry object for the current job run.
JobSchedulerHistoryInfoEntry jobHistoryInfo.getLastExecution()Get the JobSchedulerHistoryInfoEntry object for the most recently started job run including running jobs and jobs that completed successfully or failed with error.
JobSchedulerHistoryInfoEntry jobHistoryInfo.getLastCompleted()Get the JobSchedulerHistoryInfoEntry object for the most recently completed job run including jobs that completed successfully or failed with error.
JobSchedulerHistoryInfoEntry jobHistoryInfo.getLastCompletedSuccessful()Get the JobSchedulerHistoryInfoEntry object for the most recently successfully completed job run.
JobSchedulerHistoryInfoEntry jobHistoryInfo.getLastCompletedWithError()Get the JobSchedulerHistoryInfoEntry object for the most recently completed job run that failed with error.
Checks for any job runs in the period of the current day
boolean jobHistoryInfo.isStartedToday()Indicates that a job run started within the current period and applies to running jobs and completed job runs.
boolean jobHistoryInfo.isStartedTodayCompleted()Indicates that a job run started and completed within the current period and applies to job runs that completed successfully or failed with errror.
boolean jobHistoryInfo.isStartedTodayCompletedSuccessful()Indicates that a job run started and completed successfully within the current period.
boolean jobHistoryInfo.isStartedTodayCompletedWithError()Indicates that a job run started and completed with error within the current period.
Checks for any job runs that completed today 
boolean jobHistoryInfo.isCompletedToday()Indicates that a job run completed in the current period and applies to job runs that completed successfully or failed with error.
boolean jobHistoryInfo.isCompletedTodaySuccessful()

Indicates that a job run completed successfully within the current period.

boolean jobHistoryInfo.isCompletedTodayWithError()Indicates that a job run completed with error within the current period.
Checks for any job runs that ended after a specific point in time

boolean jobHistoryInfo.

endedAfter

isCompletedAfter( "03:00:00" )

indicates that a job run completed after the given date

boolean jobHistoryInfo.

endedWithSuccessfulAfter

endedAfter( "03:00:00" )

indicates that a job run completed successfully after the given date

boolean jobHistoryInfo.

endedWithErrorAfter

isCompletedWithSuccessfulAfter( "03:00:00" )

indicates that a job run completed with error after the given date

boolean jobHistoryInfo.

startedAfter

endedWithSuccessfulAfter( "03:00:00" )

indicates that a job run started completed successfully after the given date

boolean jobHistoryInfo.isCompletedWithErrorAfter( "03:00:00" ), the job might be completed or running

boolean jobHistoryInfo.

startedSuccessfulAfter

endedWithErrorAfter( "03:00:00" )

indictes indicates that a job run started completed with error after the given date and does not report any errors, the job might be completed or running
Checks for any job runs that started after a specific point in time
boolean jobHistoryInfo.startedAfterboolean jobHistoryInfo.startedWithErrorAfter( "03:00:00" )

indicates that a job run started after the given date

and does report errors,

, the job might be completed or running

JobHistoryInformationEntry Object

The object represents the history for a specific job run and is provided by the JobHistoryInformation object.

boolean jobHistoryInfo.startedSuccessfulAfter( "03:00:00" )indictes that a job run started after the given date and does not report any errors, the job might be completed or running
boolean jobHistoryInfo.startedWithErrorAfter( "03:00:00" )indicates that a job run started after the given date and does report errors, the job might be completed or running

JobHistoryInformationEntry Object

The object represents the history for a specific job run and is provided by the JobHistoryInformation object.

ObjectDescription
JobSchedulerHistoryInfoEntry jobHistoryInfo.getRunning()
ObjectDescription
JobSchedulerHistoryInfoEntry jobHistoryInfo.getRunning()Get the JobSchedulerHistoryInfoEntry object for the current job run. If used in a job's pre-processing monitor then this method will return an empty object as the job is not currently running.
JobSchedulerHistoryInfoEntry jobHistoryInfo.getLastExecution()Get the JobSchedulerHistoryInfoEntry object for the most recently started job run including running jobs and jobs that completed successfully or failed with error.
... 
PropertyDescription
nameContains the job name.
foundIndicates if the associated object is not null.
idExposes the unique task identification as provided by JobScheduler.
positionReturns the position of the object in the job execution history: a value 0 signals the most recent entry, larger values suggest older entries.
startReturns the start date of the job run.
endReturns the end date of the job run.
durationReturns the duration in the format hh:mm:ss. If longer the one day d:hh:mm:ss
executionResultProvides the exit code for shell jobs or -1 if no exit code is provided, e.g. for API jobs.
errorIndicats an error status, 1=error, 0=no error.
errorMessageReturns the error message as provided e.g. for shell jobs by the operating system, for API jobs from exceptions.
errorCodeOptionally returns an error code, e.g. from API jobs that raise defined exceptions.

...

  • The implementation makes use of API methods, i.e. XML commands, to retrieve the job history instead of a database connection.
  • The solution can be used with Agents.
  • No separate HTTP connection is created, the solution makes use of the HTTP(S) connection that is established between Master and Agent.

References

Change Management References

Jira
serverSOS JIRA
columnstype,key,issuelinks,fixversions,status,priority,summary,updated
maximumIssues20
jqlQuerylabels in (job-history)
serverId6dc67751-9d67-34cd-985b-194a8cdc9602

Documentation