JobSpecification

API: Stable

A specification of a Job

data class JobSpecification(
    val application: NameAndVersion,
    val product: ProductReference,
    val name: String?,
    val replicas: Int?,
    val allowDuplicateJob: Boolean?,
    val parameters: JsonObject?,
    val resources: List<AppParameterValue>?,
    val timeAllocation: SimpleDuration?,
    val openedFile: String?,
    val restartOnExit: Boolean?,
    val sshEnabled: Boolean?,
)
Properties
application: NameAndVersion A reference to the application which this job should execute
product: ProductReference A reference to the product that this job will be executed on
name: String? A name for this job assigned by the user.

The name can help a user identify why and with which parameters a job was started. This value is suitable for display in user interfaces.

replicas: Int? The number of replicas to start this job in

The resources supplied will be mounted in every replica. Some resources might only be supported in an ‘exclusive use’ mode. This will cause the job to fail if replicas != 1.

allowDuplicateJob: Boolean? Allows the job to be started even when a job is running in an identical configuration

API: Internal/Beta

By default, UCloud will prevent you from accidentally starting two jobs with identical configuration. This field must be set to true to allow you to create two jobs with identical configuration.

parameters: JsonObject? Parameters which are consumed by the job

The available parameters are defined by the application. This attribute is not included by default unless includeParameters is specified.

resources: List<AppParameterValue>? Additional resources which are made available into the job

This attribute is not included by default unless includeParameters is specified. Note: Not all resources can be attached to a job. UCloud supports the following parameter types as resources:

  • file

  • peer

  • network

  • block_storage

  • ingress

timeAllocation: SimpleDuration? Time allocation for the job

This value can be null which signifies that the job should not (automatically) expire. Note that some providers do not support null. When this value is not null it means that the job will be terminated, regardless of result, after the duration has expired. Some providers support extended this duration via the extend operation.

openedFile: String? An optional path to the file which the user selected with the "Open with..." feature.

API: Experimental/Alpha

This value is null if the application is not launched using the “Open with…” feature. The value of this is passed to the compute environment in a provider specific way. We encourage providers to expose this as an environment variable named UCLOUD_OPEN_WITH_FILE containing the absolute path of the file (in the current environment). Remember that this path is the UCloud path to the file and not the provider’s path.

restartOnExit: Boolean? A flag which indicates if this job should be restarted on exit.

API: Experimental/Alpha

Not all providers support this feature and the Job will be rejected if not supported. This information can also be queried through the product support feature.

If this flag is true then the Job will automatically be restarted when the provider notifies the orchestrator about process termination. It is the responsibility of the orchestrator to notify the provider about restarts. If the restarts are triggered by the provider, then the provider must not notify the orchestrator about the termination. The orchestrator will trigger a new create request in a timely manner. The orchestrator decides when to trigger a new create. For example, if a process is terminating often, then the orchestrator might decide to wait before issuing a new create.

sshEnabled: Boolean? A flag which indicates that this job should use the built-in SSH functionality of the application/provider

API: Experimental/Alpha

This flag can only be true of the application itself is marked as SSH enabled. When this flag is true, an SSH server will be started which allows the end-user direct access to the associated compute workload.