API schedule - RapturePlatform/Rapture GitHub Wiki

Schedule API

The methods in this API control the scheduler function in a Rapture implementation.

createJob

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
RaptureJob retVal = scheduleApi.createJob(jobURI, description, scriptURI, cronExpression, timeZone, jobParams, autoActivate);
retVal = baseAPI.doSchedule_CreateJob(jobURI, description, scriptURI, cronExpression, timeZone, jobParams, autoActivate);

Entitlement: /admin/schedule

Creates a new job. The executableURI should point to a RaptureScript. A job needs to be activated for it be available for execution. A job can be either auto-activate (i.e. it is activated, then de-activated while it runs, then activated on completion. OR it can be not-auto-activate, whereupon it needs to be activatedmanually, by either a predecessor job (a job that has this job as a dependency) or manually via the activate schedule API call.

Function Parameters

Parameter Type Description
jobURI String
description String
scriptURI String
cronExpression String
timeZone String
jobParams Map<String,String>
autoActivate boolean

Return value

Type Description
RaptureJob
Types used in this function

RaptureJob

Contains info for a script-driven job in Rapture.

Field Type
jobURI JobURI
description String
scriptURI ScriptURI
cronSpec String
timeZone String
params Map<String, String>
autoActivate Boolean
activated Boolean
jobType JobType
maxRuntimeMinutes Integer
appStatusNamePattern String

createWorkflowJob

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
RaptureJob retVal = scheduleApi.createWorkflowJob(jobURI, description, workflowURI, cronExpression, timeZone, jobParams, autoActivate, maxRuntimeMinutes, appStatusNamePattern);
retVal = baseAPI.doSchedule_CreateWorkflowJob(jobURI, description, workflowURI, cronExpression, timeZone, jobParams, autoActivate, maxRuntimeMinutes, appStatusNamePattern);

Entitlement: /admin/schedule

Creates a new Workflow-based job. The executableURI should point to a Workflow. A WorkOrder will be createdwhen the job is executed. The jobParams will be passed in to the Workflow as the contextMap.The maxRuntimeMinutes will be used to throw alerts when the job runs longer than expected.A job needs to be activated for it be available for execution. A job can be either auto-activate (i.e. it is activated, then de-activated while it runs, then activated on completion. OR it can be not-auto-activate, whereupon it needs to be activatedmanually, by either a predecessor job (a job that has this job as a dependency) or manually via the activate schedule API call.

Function Parameters

Parameter Type Description
jobURI String
description String
workflowURI String
cronExpression String
timeZone String
jobParams Map<String,String>
autoActivate boolean
maxRuntimeMinutes int
appStatusNamePattern String

Return value

Type Description
RaptureJob
Types used in this function

RaptureJob

Contains info for a script-driven job in Rapture.

Field Type
jobURI JobURI
description String
scriptURI ScriptURI
cronSpec String
timeZone String
params Map<String, String>
autoActivate Boolean
activated Boolean
jobType JobType
maxRuntimeMinutes Integer
appStatusNamePattern String

activateJob

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
void retVal = scheduleApi.activateJob(jobURI, extraParams);
retVal = baseAPI.doSchedule_ActivateJob(jobURI, extraParams);

Entitlement: /admin/schedule

Activate a job (usually that is not auto-activate). This means that the job will now be picked up by the scheduler and executed at whatever time it is configured to run.

Function Parameters

Parameter Type Description
jobURI String
extraParams Map<String,String>

Return value

Type Description
void

deactivateJob

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
void retVal = scheduleApi.deactivateJob(jobURI);
retVal = baseAPI.doSchedule_DeactivateJob(jobURI);

Entitlement: /admin/schedule

Turns off a job's schedule-based execution.

Function Parameters

Parameter Type Description
jobURI String

Return value

Type Description
void

retrieveJob

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
RaptureJob retVal = scheduleApi.retrieveJob(jobURI);
retVal = baseAPI.doSchedule_RetrieveJob(jobURI);

Entitlement: /admin/schedule

Retrieve the definition of a job given its URI.

Function Parameters

Parameter Type Description
jobURI String

Return value

Type Description
RaptureJob
Types used in this function

RaptureJob

Contains info for a script-driven job in Rapture.

Field Type
jobURI JobURI
description String
scriptURI ScriptURI
cronSpec String
timeZone String
params Map<String, String>
autoActivate Boolean
activated Boolean
jobType JobType
maxRuntimeMinutes Integer
appStatusNamePattern String

retrieveJobs

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
List<RaptureJob> retVal = scheduleApi.retrieveJobs(uriPrefix);
retVal = baseAPI.doSchedule_RetrieveJobs(uriPrefix);

Entitlement: /admin/schedule

Retrieve the definition of all jobs in the system whose uri starts with a certain prefix (e.g job://my/jobs/date1)

Function Parameters

Parameter Type Description
uriPrefix String

Return value

Type Description
List

runJobNow

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
void retVal = scheduleApi.runJobNow(jobURI, extraParams);
retVal = baseAPI.doSchedule_RunJobNow(jobURI, extraParams);

Entitlement: /admin/schedule

Try to schedule this job to run as soon as possible.

Function Parameters

Parameter Type Description
jobURI String
extraParams Map<String,String>

Return value

Type Description
void

resetJob

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
void retVal = scheduleApi.resetJob(jobURI);
retVal = baseAPI.doSchedule_ResetJob(jobURI);

Entitlement: /admin/schedule

Removes the upcoming scheduled execution of this job and schedules it to run according to the cron in the job configuration.

Function Parameters

Parameter Type Description
jobURI String

Return value

Type Description
void

retrieveJobExec

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
RaptureJobExec retVal = scheduleApi.retrieveJobExec(jobURI, execTime);
retVal = baseAPI.doSchedule_RetrieveJobExec(jobURI, execTime);

Entitlement: /admin/schedule

Retrieves the execution of a job.

Function Parameters

Parameter Type Description
jobURI String
execTime Long

Return value

Type Description
RaptureJobExec
Types used in this function

RaptureJobExec

Contains info about an active or queued job.

Field Type
jobURI JobURI
jobType JobType
status JobExecStatus
execTime Long
passedParams Map<String, String>
execDetails String

deleteJob

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
void retVal = scheduleApi.deleteJob(jobURI);
retVal = baseAPI.doSchedule_DeleteJob(jobURI);

Entitlement: /admin/schedule

Removes a job from the system.

Function Parameters

Parameter Type Description
jobURI String

Return value

Type Description
void

getJobs

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
List<String> retVal = scheduleApi.getJobs();
retVal = baseAPI.doSchedule_GetJobs();

Entitlement: /admin/schedule

Retrieves all of the JobURI addresses of the jobs in the system.

Function Parameters

This function takes no parameters.

Return value

Type Description
List

getUpcomingJobs

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
List<RaptureJobExec> retVal = scheduleApi.getUpcomingJobs();
retVal = baseAPI.doSchedule_GetUpcomingJobs();

Entitlement: /admin/schedule

Retrieves all of the upcoming jobs in the system.

Function Parameters

This function takes no parameters.

Return value

Type Description
List

getWorkflowExecsStatus

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
WorkflowExecsStatus retVal = scheduleApi.getWorkflowExecsStatus();
retVal = baseAPI.doSchedule_GetWorkflowExecsStatus();

Entitlement: /admin/schedule

Retrieves the status of all current workflow-based job executions. This looks into the last execution as well as upcoming execution for all scheduled jobs. The return object contains a list of jobs that succeeded, failed, are overrun, or are ok (i.e. either scheduled to start in the future or currently running but not overrun). For failed or overrun jobs, information is also returned as to whether the failure/overrun has been acknowledged. See also ackJobError.

Function Parameters

This function takes no parameters.

Return value

Type Description
WorkflowExecsStatus
Types used in this function

WorkflowExecsStatus

The status for a workflow-based job that's already completed.

Field Type
failed List
ok List
overrun List
success List

ackJobError

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
JobErrorAck retVal = scheduleApi.ackJobError(jobURI, execTime, jobErrorType);
retVal = baseAPI.doSchedule_AckJobError(jobURI, execTime, jobErrorType);

Entitlement: /admin/schedule

Acknowledges a job failure, storing the acknowledgment in Rapture. This information is returned when retrieving job statuses. See also getWorkflowExecsStatus.

Function Parameters

Parameter Type Description
jobURI String
execTime Long
jobErrorType String

Return value

Type Description
JobErrorAck
Types used in this function

JobErrorAck

Acknowledgement of a job failure or delay.

Field Type
jobURI JobURI
execTime Long
errorType JobErrorType
timestamp Long
user String

getNextExec

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
RaptureJobExec retVal = scheduleApi.getNextExec(jobURI);
retVal = baseAPI.doSchedule_GetNextExec(jobURI);

Entitlement: /admin/schedule

Gets the next execution time for a given job.

Function Parameters

Parameter Type Description
jobURI String

Return value

Type Description
RaptureJobExec
Types used in this function

RaptureJobExec

Contains info about an active or queued job.

Field Type
jobURI JobURI
jobType JobType
status JobExecStatus
execTime Long
passedParams Map<String, String>
execDetails String

getJobExecs

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
List<RaptureJobExec> retVal = scheduleApi.getJobExecs(jobURI, start, count, reversed);
retVal = baseAPI.doSchedule_GetJobExecs(jobURI, start, count, reversed);

Entitlement: /admin/schedule

Retrieves a list of job executions in a given range.

Function Parameters

Parameter Type Description
jobURI String
start int
count int
reversed boolean

Return value

Type Description
List

batchGetJobExecs

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
List<RaptureJobExec> retVal = scheduleApi.batchGetJobExecs(jobURI, start, count, reversed);
retVal = baseAPI.doSchedule_BatchGetJobExecs(jobURI, start, count, reversed);

Entitlement: /admin/schedule

Retrieve a list of job executions for a list of jobs. This will return the job executions starting at index start (inclusive), and going onfor count. If reverse is true, it starts from the end.

Function Parameters

Parameter Type Description
jobURI List
start int
count int
reversed boolean

Return value

Type Description
List

isJobReadyToRun

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
boolean retVal = scheduleApi.isJobReadyToRun(toJobURI);
retVal = baseAPI.doSchedule_IsJobReadyToRun(toJobURI);

Entitlement: /admin/schedule

Return whether the given job is ready to run.

Function Parameters

Parameter Type Description
toJobURI String

Return value

Type Description
boolean

getCurrentWeekTimeRecords

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
List<TimedEventRecord> retVal = scheduleApi.getCurrentWeekTimeRecords(weekOffsetfromNow);
retVal = baseAPI.doSchedule_GetCurrentWeekTimeRecords(weekOffsetfromNow);

Entitlement: /admin/schedule

For TimeServer, get a list of scheduled events for this week (starts on Sunday, use offset to look at next week)

Function Parameters

Parameter Type Description
weekOffsetfromNow int

Return value

Type Description
List

getCurrentDayJobs

HttpScheduleApi scheduleApi = new HttpScheduleApi(loginApi);
List<TimedEventRecord> retVal = scheduleApi.getCurrentDayJobs();
retVal = baseAPI.doSchedule_GetCurrentDayJobs();

Entitlement: /admin/schedule

For TimeServer, get a list of scheduled jobs for the current day

Function Parameters

This function takes no parameters.

Return value

Type Description
List
⚠️ **GitHub.com Fallback** ⚠️