Package com.carfey.ops.api.embedded
Class RuntimeManager
- java.lang.Object
-
- com.carfey.ops.api.embedded.AbstractAPIManager
-
- com.carfey.ops.api.embedded.RuntimeManager
-
public class RuntimeManager extends AbstractAPIManager
Class to manage job runtimes using the Obsidian public embedded API. SeeAbstractAPIManagerfor details on how transactions are managed within all requests.Operations include listing runtimes, previewing future runtimes, job interruption, one-time job submission or resubmission, etc.
Example:
RuntimeListing last24Hours = new RuntimeManager().listRuntimes(null); System.out.println("Jobs run in last 24 hours: " + last24Hours);- Since:
- 2.3
- See Also:
- Embedded API Wiki, REST API Wiki, Carfey Date
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.carfey.ops.api.embedded.AbstractAPIManager
AbstractAPIManager.ActionCallable
-
-
Constructor Summary
Constructors Constructor Description RuntimeManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OneTimeDeletionResultdeleteOneTimeRun(long jobId, OneTimeRunDeleteRequest request, java.lang.String auditUser)Delete a one-time job execution scheduled for the future.RuntimeResultgetRuntime(long jobRuntimeId)Load details of a specific job runtime (i.e.JobInterruptResultinterruptRuntime(long jobRuntimeId, java.lang.String auditUser)Submit an interruption request for an actively running job.JobDashboardListinglistJobsDashboard(JobDashboardListingParameters parameters)Searches/lists configured jobs by last run status.RuntimePreviewListinglistRuntimePreviews(RuntimePreviewParameters parameters)Preview a list of expected job runtimes as aRuntimePreviewListing, based on the current schedule state.RuntimeListinglistRuntimes(RuntimeListingParameters parameters)Preview a list of existing job runtimes as aRuntimeListing(i.e.RuntimeResubmissionResultresubmitRuntime(long jobRuntimeId, java.lang.String auditUser)Resubmit a failed job execution (i.e.protected RuntimeListingrunRuntimeListing(java.util.Map<java.lang.String,java.lang.String[]> params)RuntimeResultsetAsyncRuntimeResults(long jobRuntimeId, AsyncJobRuntimeResultsRequest request, java.lang.String auditUser)Finalize an async job as completed or failed.RuntimeSubmissionResultsubmitRuntime(long jobId, RuntimeSubmissionRequest request, java.lang.String auditUser)Submit a one-time or ad hoc job execution.-
Methods inherited from class com.carfey.ops.api.embedded.AbstractAPIManager
addParameter, runApiTarget, validateRequired, withTransaction
-
-
-
-
Method Detail
-
listRuntimePreviews
public RuntimePreviewListing listRuntimePreviews(RuntimePreviewParameters parameters) throws ValidationException, java.lang.Exception
Preview a list of expected job runtimes as aRuntimePreviewListing, based on the current schedule state.- Parameters:
parameters- options to refine the search (null will use default options)- Returns:
- the full
RuntimePreviewListingbased on the supplied parameters (never null) - Throws:
ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.
-
listRuntimes
public RuntimeListing listRuntimes(RuntimeListingParameters parameters) throws ValidationException, java.lang.Exception
Preview a list of existing job runtimes as aRuntimeListing(i.e. job history).- Parameters:
parameters- options to refine the search (null will use default options)- Returns:
- the full
RuntimeListingbased on the supplied parameters (never null) - Throws:
ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.
-
listJobsDashboard
public JobDashboardListing listJobsDashboard(JobDashboardListingParameters parameters) throws ValidationException, java.lang.Exception
Searches/lists configured jobs by last run status.- Parameters:
parameters- options for searching configured jobs (defaulted if null)- Returns:
- the
JobDashboardListingmatching the supplied parameter (never null) - Throws:
ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.
-
runRuntimeListing
protected RuntimeListing runRuntimeListing(java.util.Map<java.lang.String,java.lang.String[]> params) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getRuntime
public RuntimeResult getRuntime(long jobRuntimeId) throws MissingEntityException, java.lang.Exception
Load details of a specific job runtime (i.e. job history).- Parameters:
jobRuntimeId- Id of the job runtime to load.- Returns:
- the details of the job runtime (never null)
- Throws:
MissingEntityException- If the runtime with the requested id does not exist.java.lang.Exception- Any other type of unexpected exception.
-
submitRuntime
public RuntimeSubmissionResult submitRuntime(long jobId, RuntimeSubmissionRequest request, java.lang.String auditUser) throws MissingEntityException, ValidationException, java.lang.Exception
Submit a one-time or ad hoc job execution.- Parameters:
jobId- Id of the job instance to submit.request- Details of the request, including runtime parameters and the desired scheduled time (not null)auditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- the result of the successful submission (never null)
- Throws:
MissingEntityException- If the job with the requested id does not exist.ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.
-
deleteOneTimeRun
public OneTimeDeletionResult deleteOneTimeRun(long jobId, OneTimeRunDeleteRequest request, java.lang.String auditUser) throws MissingEntityException, ValidationException, java.lang.Exception
Delete a one-time job execution scheduled for the future.- Parameters:
jobId- Id of the job instance to submit.request- Details of the deletion requestauditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- the result of the successful submission (never null)
- Throws:
MissingEntityException- If the job with the requested id does not exist.ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.
-
resubmitRuntime
public RuntimeResubmissionResult resubmitRuntime(long jobRuntimeId, java.lang.String auditUser) throws MissingEntityException, ValidationException, java.lang.Exception
Resubmit a failed job execution (i.e. job runtime / job history)- Parameters:
jobRuntimeId- Id of the job runtime to resubmit.auditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- the result of the successful resubmission (never null)
- Throws:
MissingEntityException- If the job runtime with the requested id does not exist.ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.
-
interruptRuntime
public JobInterruptResult interruptRuntime(long jobRuntimeId, java.lang.String auditUser) throws MissingEntityException, ValidationException, java.lang.Exception
Submit an interruption request for an actively running job.- Parameters:
jobRuntimeId- Id of the job runtime to interrupt.auditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- the result of the interruption (never null). Note that this does not mean the job was yet terminated.
- Throws:
MissingEntityException- If the job runtime with the requested id does not exist.ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.
-
setAsyncRuntimeResults
public RuntimeResult setAsyncRuntimeResults(long jobRuntimeId, AsyncJobRuntimeResultsRequest request, java.lang.String auditUser) throws MissingEntityException, ValidationException, java.lang.Exception
Finalize an async job as completed or failed.- Parameters:
jobRuntimeId- Id of the job runtime to mark as complete.request- Request that indicates the completion state and time and, optionally, any job results that are to be set on the runtime.auditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- the details of the job runtime (never null)
- Throws:
MissingEntityException- If the job runtime with the requested id does not exist.ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.- Since:
- 4.5
-
-