Class: Google::Apis::BatchV1::TaskSpec
- Inherits:
-
Object
- Object
- Google::Apis::BatchV1::TaskSpec
- 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
-
#compute_resource ⇒ Google::Apis::BatchV1::ComputeResource
Compute resource requirements.
-
#environment ⇒ Google::Apis::BatchV1::Environment
An Environment describes a collection of environment variables to set when executing Tasks.
-
#environments ⇒ Hash<String,String>
Deprecated: please use environment(non-plural) instead.
-
#lifecycle_policies ⇒ Array<Google::Apis::BatchV1::LifecyclePolicy>
Lifecycle management schema when any task in a task group is failed.
-
#max_retry_count ⇒ Fixnum
Maximum number of retries on failures.
-
#max_run_duration ⇒ String
Maximum duration the task should run before being automatically retried (if enabled) or automatically failed.
-
#runnables ⇒ Array<Google::Apis::BatchV1::Runnable>
Required.
-
#volumes ⇒ Array<Google::Apis::BatchV1::Volume>
Volumes to mount before running Tasks using this TaskSpec.
Instance Method Summary collapse
-
#initialize(**args) ⇒ TaskSpec
constructor
A new instance of TaskSpec.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ TaskSpec
Returns a new instance of TaskSpec.
2556 2557 2558 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2556 def initialize(**args) update!(**args) end |
Instance Attribute Details
#compute_resource ⇒ Google::Apis::BatchV1::ComputeResource
Compute resource requirements. ComputeResource defines the amount of resources
required for each task. Make sure your tasks have enough resources to
successfully run. If you also define the types of resources for a job to use
with the InstancePolicyOrTemplate field,
make sure both fields are compatible with each other.
Corresponds to the JSON property computeResource
2498 2499 2500 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2498 def compute_resource @compute_resource end |
#environment ⇒ Google::Apis::BatchV1::Environment
An Environment describes a collection of environment variables to set when
executing Tasks.
Corresponds to the JSON property environment
2504 2505 2506 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2504 def environment @environment end |
#environments ⇒ Hash<String,String>
Deprecated: please use environment(non-plural) instead.
Corresponds to the JSON property environments
2509 2510 2511 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2509 def environments @environments end |
#lifecycle_policies ⇒ Array<Google::Apis::BatchV1::LifecyclePolicy>
Lifecycle management schema when any task in a task group is failed. Currently
we only support one lifecycle policy. When the lifecycle policy condition is
met, the action in the policy will execute. If task execution result does not
meet with 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
2519 2520 2521 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2519 def lifecycle_policies @lifecycle_policies end |
#max_retry_count ⇒ Fixnum
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
2525 2526 2527 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2525 def max_retry_count @max_retry_count end |
#max_run_duration ⇒ String
Maximum duration the task should run before being automatically retried (if
enabled) or automatically failed. Format the value of this field as a time
limit in seconds followed by s—for example, 3600s for 1 hour. The field
accepts any value between 0 and the maximum listed for the Duration field
type at https://protobuf.dev/reference/protobuf/google.protobuf/#duration;
however, the actual maximum run time for a job will be limited to the maximum
run time for a job listed at https://cloud.google.com/batch/quotas#max-job-
duration.
Corresponds to the JSON property maxRunDuration
2537 2538 2539 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2537 def max_run_duration @max_run_duration end |
#runnables ⇒ Array<Google::Apis::BatchV1::Runnable>
Required. The sequence of one or more runnables (executable scripts,
executable containers, and/or barriers) for each task in this task group to
run. Each task runs this list of runnables in order. For a task to succeed,
all of its script and container runnables each must meet at least one of the
following conditions: + The runnable exited with a zero status. + The runnable
didn't finish, but you enabled its background subfield. + The runnable
exited with a non-zero status, but you enabled its ignore_exit_status
subfield.
Corresponds to the JSON property runnables
2549 2550 2551 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2549 def runnables @runnables end |
#volumes ⇒ Array<Google::Apis::BatchV1::Volume>
Volumes to mount before running Tasks using this TaskSpec.
Corresponds to the JSON property volumes
2554 2555 2556 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2554 def volumes @volumes end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 |
# File 'lib/google/apis/batch_v1/classes.rb', line 2561 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 |