Interface SupportsJobs

All Known Implementing Classes:
GravitinoClient, GravitinoMetalake

public interface SupportsJobs
Interface for job management operations. This interface will be mixed with GravitinoClient to provide the ability to manage job templates and jobs within the Gravitino system.
  • Method Details

    • listJobTemplates

      List<JobTemplate> listJobTemplates()
      Lists all the registered job templates in Gravitino.
      Returns:
      a list of job templates
    • registerJobTemplate

      void registerJobTemplate(JobTemplate jobTemplate) throws JobTemplateAlreadyExistsException
      Register a job template with the specified job template to Gravitino. The registered job template will be maintained in Gravitino, allowing it to be executed later.
      Parameters:
      jobTemplate - the template for the job
      Throws:
      JobTemplateAlreadyExistsException - if a job template with the same name already exists
    • getJobTemplate

      JobTemplate getJobTemplate(String jobTemplateName) throws NoSuchJobTemplateException
      Retrieves a job template by its name.
      Parameters:
      jobTemplateName - the name of the job template to retrieve
      Returns:
      the job template associated with the specified name
      Throws:
      NoSuchJobTemplateException - if no job template with the specified name exists
    • deleteJobTemplate

      boolean deleteJobTemplate(String jobTemplateName) throws InUseException
      Deletes a job template by its name. This will remove the job template from Gravitino, and it will no longer be available for execution. Only when all the jobs associated with this job template are completed, failed, or cancelled, the job template can be deleted successfully, otherwise it will throw an exception.

      The deletion of a job template will also delete all the jobs associated with this template.

      Parameters:
      jobTemplateName - the name of the job template to delete
      Returns:
      true if the job template was successfully deleted, false if the job template does not exist
      Throws:
      InUseException - if there are still queued or started jobs associated with the job template
    • listJobs

      List<JobHandle> listJobs(String jobTemplateName) throws NoSuchJobTemplateException
      Lists all the jobs by the specified job template name. This will return a list of job handles associated with the specified job template. Each job handle represents a specific job.
      Parameters:
      jobTemplateName - the name of the job template to list jobs for
      Returns:
      a list of job handles associated with the specified job template
      Throws:
      NoSuchJobTemplateException - if no job template with the specified name exists
    • listJobs

      List<JobHandle> listJobs()
      Lists all the jobs in Gravitino. This will return a list of all job handles, regardless of the job template they are associated with.
      Returns:
      a list of all job handles in Gravitino
    • runJob

      JobHandle runJob(String jobTemplateName, Map<String,String> jobConf) throws NoSuchJobTemplateException
      Run a job with the template name and configuration. The jobConf is a map of key-value contains the variables that will be used to replace the templated parameters in the job template.
      Parameters:
      jobTemplateName - the name of the job template to run
      jobConf - the configuration for the job
      Returns:
      a handle to the run job
      Throws:
      NoSuchJobTemplateException - if no job template with the specified name exists
    • getJob

      JobHandle getJob(String jobId) throws NoSuchJobException
      Retrieves a job by its ID.
      Parameters:
      jobId - the ID of the job to retrieve
      Returns:
      a handle to the job
      Throws:
      NoSuchJobException - if the job with the specified ID does not exist
    • cancelJob

      JobHandle cancelJob(String jobId) throws NoSuchJobException
      Cancel a job by its ID. This operation will attempt to cancel the job if it is still running. This method will return immediately, user could use the job handle to check the status of the job after invoking this method.
      Parameters:
      jobId - the ID of the job to cancel
      Returns:
      a handle to the cancelled job
      Throws:
      NoSuchJobException - if the job with the specified ID does not exist