gravitino.api.job.shell_job_template.ShellJobTemplate

class gravitino.api.job.shell_job_template.ShellJobTemplate(builder: Builder)

Bases: JobTemplate

Represents a job template for executing shell scripts.

__init__(builder: Builder)

Initializes a ShellJobTemplate instance.

Methods

__init__(builder)

Initializes a ShellJobTemplate instance.

builder()

Creates a new builder instance for constructing a ShellJobTemplate.

job_type()

Returns the type of the job, which is SHELL for this template.

Attributes

arguments

Returns:

comment

Returns:

custom_fields

Returns:

environments

Returns:

executable

Returns:

name

Returns:

scripts

Returns the list of shell scripts associated with this job template.

class BaseBuilder

Bases: Generic[B, T]

BaseBuilder is a generic class to build a JobTemplate.

abstract build() T

Builds the JobTemplate instance.

Returns:

An instance of JobTemplate with the configured parameters.

validate()

Validates the job template parameters.

with_arguments(arguments: List[str]) B

Sets the arguments of the job template.

Args:

arguments: The arguments of the job template.

Returns:

The builder instance for method chaining.

with_comment(comment: str) B

Sets the comment of the job template.

Args:

comment: The comment of the job template. It can be null or empty.

Returns:

The builder instance for method chaining.

with_custom_fields(custom_fields: Dict[str, str]) B

Sets the custom fields of the job template.

Args:

custom_fields: The custom fields of the job template.

Returns:

The builder instance for method chaining.

with_environments(environments: Dict[str, str]) B

Sets the environment variables of the job template.

Args:

environments: The environment variables of the job template.

Returns:

The builder instance for method chaining.

with_executable(executable: str) B

Sets the executable of the job template.

Args:

executable: The executable of the job template. It must not be null or empty.

Returns:

The builder instance for method chaining.

with_name(name: str) B

Sets the name of the job template.

Args:

name: The name of the job template. It must not be null or empty.

Returns:

The builder instance for method chaining.

class Builder

Bases: BaseBuilder[ShellJobTemplate.Builder, ShellJobTemplate]

Builder class for creating ShellJobTemplate instances.

build() ShellJobTemplate

Builds and returns a ShellJobTemplate instance.

Returns:

ShellJobTemplate: The constructed shell job template.

validate()

Validates the builder state before building the ShellJobTemplate.

with_arguments(arguments: List[str]) B

Sets the arguments of the job template.

Args:

arguments: The arguments of the job template.

Returns:

The builder instance for method chaining.

with_comment(comment: str) B

Sets the comment of the job template.

Args:

comment: The comment of the job template. It can be null or empty.

Returns:

The builder instance for method chaining.

with_custom_fields(custom_fields: Dict[str, str]) B

Sets the custom fields of the job template.

Args:

custom_fields: The custom fields of the job template.

Returns:

The builder instance for method chaining.

with_environments(environments: Dict[str, str]) B

Sets the environment variables of the job template.

Args:

environments: The environment variables of the job template.

Returns:

The builder instance for method chaining.

with_executable(executable: str) B

Sets the executable of the job template.

Args:

executable: The executable of the job template. It must not be null or empty.

Returns:

The builder instance for method chaining.

with_name(name: str) B

Sets the name of the job template.

Args:

name: The name of the job template. It must not be null or empty.

Returns:

The builder instance for method chaining.

with_scripts(scripts: List[str]) Builder

Sets the shell scripts for this job template.

Args:

scripts: A list of shell scripts to be executed by this job template.

Returns:

ShellJobTemplate.Builder: The builder instance for method chaining.

property arguments: List[str]
Returns:

The arguments of the job template, which are the parameters that will be passed to the executable when the job is run.

static builder() Builder

Creates a new builder instance for constructing a ShellJobTemplate.

Returns:

ShellJobTemplate.Builder: A new builder instance.

property comment: str | None
Returns:

The comment of the job template, which can be used to describe the job. This field is optional and can be None.

property custom_fields: Dict[str, str]
Returns:

Custom fields of the job template, which are additional key-value pairs that can be used to store any other information related to the job. This field is optional and can be empty.

property environments: Dict[str, str]
Returns:

The environment variables of the job template, which are key-value pairs that will be set in the environment when the job is run. This can include variables that can be templated with actual values when running the job.

property executable: str
Returns:

The executable of the job template, which is the command or script that will be executed when the job is run. This field is required and must not be empty.

job_type() JobType

Returns the type of the job, which is SHELL for this template.

Returns:

JobType.SHELL: Indicates that this is a shell job template.

property name: str
Returns:

The name of the job template.

property scripts: List[str]

Returns the list of shell scripts associated with this job template.

Returns:

List of shell scripts.