Class: Google::Apis::BatchV1::TaskSpec

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/batch_v1/classes.rb,
lib/google/apis/batch_v1/representations.rb,
lib/google/apis/batch_v1/representations.rb

Overview

Spec of a task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ TaskSpec

Returns a new instance of TaskSpec.



2235
2236
2237
# File 'lib/google/apis/batch_v1/classes.rb', line 2235

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#compute_resourceGoogle::Apis::BatchV1::ComputeResource

Compute resource requirements Corresponds to the JSON property computeResource



2181
2182
2183
# File 'lib/google/apis/batch_v1/classes.rb', line 2181

def compute_resource
  @compute_resource
end

#environmentGoogle::Apis::BatchV1::Environment

An Environment describes a collection of environment variables to set when executing Tasks. Corresponds to the JSON property environment



2187
2188
2189
# File 'lib/google/apis/batch_v1/classes.rb', line 2187

def environment
  @environment
end

#environmentsHash<String,String>

Deprecated: please use environment(non-plural) instead. Corresponds to the JSON property environments

Returns:

  • (Hash<String,String>)


2192
2193
2194
# File 'lib/google/apis/batch_v1/classes.rb', line 2192

def environments
  @environments
end

#lifecycle_policiesArray<Google::Apis::BatchV1::LifecyclePolicy>

Lifecycle management schema when any task in a task group is failed. The valid size of lifecycle policies are [0, 10]. For each lifecycle policy, when the condition is met, the action in that policy will execute. If there are multiple policies that the task execution result matches, we use the action from the first matched policy. If task execution result does not meet with any of the defined lifecycle policy, we consider it as the default policy. Default policy means if the exit code is 0, exit task. If task ends with non-zero exit code, retry the task with max_retry_count. Corresponds to the JSON property lifecyclePolicies



2204
2205
2206
# File 'lib/google/apis/batch_v1/classes.rb', line 2204

def lifecycle_policies
  @lifecycle_policies
end

#max_retry_countFixnum

Maximum number of retries on failures. The default, 0, which means never retry. The valid value range is [0, 10]. Corresponds to the JSON property maxRetryCount

Returns:

  • (Fixnum)


2210
2211
2212
# File 'lib/google/apis/batch_v1/classes.rb', line 2210

def max_retry_count
  @max_retry_count
end

#max_run_durationString

Maximum duration the task should run. The task will be killed and marked as FAILED if over this limit. Corresponds to the JSON property maxRunDuration

Returns:

  • (String)


2216
2217
2218
# File 'lib/google/apis/batch_v1/classes.rb', line 2216

def max_run_duration
  @max_run_duration
end

#runnablesArray<Google::Apis::BatchV1::Runnable>

The sequence of scripts or containers to run for this Task. Each Task using this TaskSpec executes its list of runnables in order. The Task succeeds if all of its runnables either exit with a zero status or any that exit with a non-zero status have the ignore_exit_status flag. Background runnables are killed automatically (if they have not already exited) a short time after all foreground runnables have completed. Even though this is likely to result in a non-zero exit status for the background runnable, these automatic kills are not treated as Task failures. Corresponds to the JSON property runnables



2228
2229
2230
# File 'lib/google/apis/batch_v1/classes.rb', line 2228

def runnables
  @runnables
end

#volumesArray<Google::Apis::BatchV1::Volume>

Volumes to mount before running Tasks using this TaskSpec. Corresponds to the JSON property volumes

Returns:



2233
2234
2235
# File 'lib/google/apis/batch_v1/classes.rb', line 2233

def volumes
  @volumes
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
# File 'lib/google/apis/batch_v1/classes.rb', line 2240

def update!(**args)
  @compute_resource = args[:compute_resource] if args.key?(:compute_resource)
  @environment = args[:environment] if args.key?(:environment)
  @environments = args[:environments] if args.key?(:environments)
  @lifecycle_policies = args[:lifecycle_policies] if args.key?(:lifecycle_policies)
  @max_retry_count = args[:max_retry_count] if args.key?(:max_retry_count)
  @max_run_duration = args[:max_run_duration] if args.key?(:max_run_duration)
  @runnables = args[:runnables] if args.key?(:runnables)
  @volumes = args[:volumes] if args.key?(:volumes)
end