Class RuntimeManager


  • public class RuntimeManager
    extends AbstractAPIManager
    Class to manage job runtimes using the Obsidian public embedded API. See AbstractAPIManager for 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
    • Constructor Detail

      • RuntimeManager

        public RuntimeManager()
    • Method Detail

      • listRuntimes

        public RuntimeListing listRuntimes​(RuntimeListingParameters parameters)
                                    throws ValidationException,
                                           java.lang.Exception
        Preview a list of existing job runtimes as a RuntimeListing (i.e. job history).
        Parameters:
        parameters - options to refine the search (null will use default options)
        Returns:
        the full RuntimeListing based 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 JobDashboardListing matching 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 request
        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.
      • 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