Class JobTemplate

java.lang.Object
org.apache.gravitino.job.JobTemplate
Direct Known Subclasses:
ShellJobTemplate, SparkJobTemplate

public abstract class JobTemplate extends Object
JobTemplate is a class to define all the configuration parameters for a job.

JobType is enum to define the type of the job, because Gravitino needs different runtime environments to execute different types of jobs, so the job type is required.

Some parameters can be templated, which means that they can be replaced with actual values when running the job, for example, arguments can be { "{{input_path}}", "{{output_path}}" }, environment variables can be { "foo": "{{foo_value}}", "bar": "{{bar_value}}" }. the parameters support templating are:

  • arguments
  • environments

executable is the path to the executable that will be run, it should be an absolute path that can be accessed by the Gravitino server, current Gravitino can support executables in the local file system, or on the web server (e.g., HTTP or HTTPS, FTP). Distributed file systems like HDFS or S3 will be supported in the future.

  • Field Details

    • name

      protected final String name
      The name of the job template.
    • comment

      protected final String comment
      The comment or description of the job template.
    • executable

      protected final String executable
      The executable path for the job template.
    • arguments

      protected final List<String> arguments
      The list of arguments for the job template.
    • environments

      protected final Map<String,String> environments
      The map of environment variables for the job template.
    • customFields

      protected final Map<String,String> customFields
      The map of custom fields for the job template.
  • Constructor Details

    • JobTemplate

      protected JobTemplate(JobTemplate.BaseBuilder<?,?> builder)
      Constructs a JobTemplate instance with the specified parameters.
      Parameters:
      builder - the builder containing the job template parameters
  • Method Details

    • jobType

      public abstract JobTemplate.JobType jobType()
      Get the job type.
      Returns:
      the type of the job template
    • name

      public String name()
      Get the name of the job template.
      Returns:
      the name of the job template
    • comment

      public String comment()
      Get the comment for the job template.
      Returns:
      the comment
    • executable

      public String executable()
      Get the executable for the job template.
      Returns:
      the executable path
    • arguments

      public List<String> arguments()
      Get the arguments for the job template.
      Returns:
      the list of arguments
    • environments

      public Map<String,String> environments()
      Get the environment variables for the job template.
      Returns:
      the map of environment variables
    • customFields

      public Map<String,String> customFields()
      Get the custom fields for the job template.
      Returns:
      the map of custom fields
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object