Class: Google::Apis::BatchV1::Runnable

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

Runnable describes instructions for executing a specific script or container as part of a Task.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Runnable

Returns a new instance of Runnable.



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

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

Instance Attribute Details

#always_runBoolean Also known as: always_run?

By default, after a Runnable fails, no further Runnable are executed. This flag indicates that this Runnable must be run even if the Task has already failed. This is useful for Runnables that copy output files off of the VM or for debugging. The always_run flag does not override the Task's overall max_run_duration. If the max_run_duration has expired then no further Runnables will execute, not even always_run Runnables. Corresponds to the JSON property alwaysRun

Returns:

  • (Boolean)


2151
2152
2153
# File 'lib/google/apis/batch_v1/classes.rb', line 2151

def always_run
  @always_run
end

#backgroundBoolean Also known as: background?

Normally, a runnable that doesn't exit causes its task to fail. However, you can set this field to true to configure a background runnable. Background runnables are allowed continue running in the background while the task executes subsequent runnables. For example, background runnables are useful for providing services to other runnables or providing debugging-support tools like SSH servers. Specifically, 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 background

Returns:

  • (Boolean)


2166
2167
2168
# File 'lib/google/apis/batch_v1/classes.rb', line 2166

def background
  @background
end

#barrierGoogle::Apis::BatchV1::Barrier

A barrier runnable automatically blocks the execution of subsequent runnables until all the tasks in the task group reach the barrier. Corresponds to the JSON property barrier



2173
2174
2175
# File 'lib/google/apis/batch_v1/classes.rb', line 2173

def barrier
  @barrier
end

#containerGoogle::Apis::BatchV1::Container

Container runnable. Corresponds to the JSON property container



2178
2179
2180
# File 'lib/google/apis/batch_v1/classes.rb', line 2178

def container
  @container
end

#display_nameString

Optional. DisplayName is an optional field that can be provided by the caller. If provided, it will be used in logs and other outputs to identify the script, making it easier for users to understand the logs. If not provided the index of the runnable will be used for outputs. Corresponds to the JSON property displayName

Returns:

  • (String)


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

def display_name
  @display_name
end

#environmentGoogle::Apis::BatchV1::Environment

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



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

def environment
  @environment
end

#ignore_exit_statusBoolean Also known as: ignore_exit_status?

Normally, a runnable that returns a non-zero exit status fails and causes the task to fail. However, you can set this field to true to allow the task to continue executing its other runnables even if this runnable fails. Corresponds to the JSON property ignoreExitStatus

Returns:

  • (Boolean)


2199
2200
2201
# File 'lib/google/apis/batch_v1/classes.rb', line 2199

def ignore_exit_status
  @ignore_exit_status
end

#labelsHash<String,String>

Labels for this Runnable. Corresponds to the JSON property labels

Returns:

  • (Hash<String,String>)


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

def labels
  @labels
end

#scriptGoogle::Apis::BatchV1::Script

Script runnable. Corresponds to the JSON property script



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

def script
  @script
end

#timeoutString

Timeout for this Runnable. Corresponds to the JSON property timeout

Returns:

  • (String)


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

def timeout
  @timeout
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
# File 'lib/google/apis/batch_v1/classes.rb', line 2222

def update!(**args)
  @always_run = args[:always_run] if args.key?(:always_run)
  @background = args[:background] if args.key?(:background)
  @barrier = args[:barrier] if args.key?(:barrier)
  @container = args[:container] if args.key?(:container)
  @display_name = args[:display_name] if args.key?(:display_name)
  @environment = args[:environment] if args.key?(:environment)
  @ignore_exit_status = args[:ignore_exit_status] if args.key?(:ignore_exit_status)
  @labels = args[:labels] if args.key?(:labels)
  @script = args[:script] if args.key?(:script)
  @timeout = args[:timeout] if args.key?(:timeout)
end