Class: Kubernetes::V1JobSpec
- Inherits:
-
Object
- Object
- Kubernetes::V1JobSpec
- Defined in:
- lib/kubernetes/models/v1_job_spec.rb
Overview
JobSpec describes how the job execution will look like.
Instance Attribute Summary collapse
-
#active_deadline_seconds ⇒ Object
Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer.
-
#backoff_limit ⇒ Object
Specifies the number of retries before marking this job failed.
-
#completions ⇒ Object
Specifies the desired number of successfully finished pods the job should be run with.
-
#manual_selector ⇒ Object
manualSelector controls generation of pod labels and pod selectors.
-
#parallelism ⇒ Object
Specifies the maximum desired number of pods the job should run at any given time.
-
#selector ⇒ Object
A label query over pods that should match the pod count.
-
#template ⇒ Object
Describes the pod that will be created when executing a job.
-
#ttl_seconds_after_finished ⇒ Object
ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed).
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ V1JobSpec
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ V1JobSpec
Initializes the object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 72 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.transform_keys(&:to_sym) if attributes.key?(:activeDeadlineSeconds) self.active_deadline_seconds = attributes[:activeDeadlineSeconds] end self.backoff_limit = attributes[:backoffLimit] if attributes.key?(:backoffLimit) self.completions = attributes[:completions] if attributes.key?(:completions) self.manual_selector = attributes[:manualSelector] if attributes.key?(:manualSelector) self.parallelism = attributes[:parallelism] if attributes.key?(:parallelism) self.selector = attributes[:selector] if attributes.key?(:selector) self.template = attributes[:template] if attributes.key?(:template) return unless attributes.key?(:ttlSecondsAfterFinished) self.ttl_seconds_after_finished = attributes[:ttlSecondsAfterFinished] end |
Instance Attribute Details
#active_deadline_seconds ⇒ Object
Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer
19 20 21 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 19 def active_deadline_seconds @active_deadline_seconds end |
#backoff_limit ⇒ Object
Specifies the number of retries before marking this job failed. Defaults to 6
22 23 24 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 22 def backoff_limit @backoff_limit end |
#completions ⇒ Object
Specifies the desired number of successfully finished pods the job should be run with. Setting to nil means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
25 26 27 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 25 def completions @completions end |
#manual_selector ⇒ Object
manualSelector controls generation of pod labels and pod selectors. Leave ‘manualSelector` unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template. When true, the user is responsible for picking unique labels and specifying the selector. Failure to pick a unique label may cause this and other jobs to not function correctly. However, You may see `manualSelector=true` in jobs that were created with the old `extensions/v1beta1` API. More info: kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector
28 29 30 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 28 def manual_selector @manual_selector end |
#parallelism ⇒ Object
Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
31 32 33 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 31 def parallelism @parallelism end |
#selector ⇒ Object
A label query over pods that should match the pod count. Normally, the system sets this field for you. More info: kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
34 35 36 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 34 def selector @selector end |
#template ⇒ Object
Describes the pod that will be created when executing a job. More info: kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
37 38 39 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 37 def template @template end |
#ttl_seconds_after_finished ⇒ Object
ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won’t be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes. This field is alpha-level and is only honored by servers that enable the TTLAfterFinished feature.
40 41 42 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 40 def ttl_seconds_after_finished @ttl_seconds_after_finished end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 43 def self.attribute_map { active_deadline_seconds: :activeDeadlineSeconds, backoff_limit: :backoffLimit, completions: :completions, manual_selector: :manualSelector, parallelism: :parallelism, selector: :selector, template: :template, ttl_seconds_after_finished: :ttlSecondsAfterFinished } end |
.swagger_types ⇒ Object
Attribute type mapping.
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 57 def self.swagger_types { active_deadline_seconds: :Integer, backoff_limit: :Integer, completions: :Integer, manual_selector: :BOOLEAN, parallelism: :Integer, selector: :V1LabelSelector, template: :V1PodTemplateSpec, ttl_seconds_after_finished: :Integer } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 120 def ==(other) return true if equal?(other) self.class == other.class && active_deadline_seconds == other.active_deadline_seconds && backoff_limit == other.backoff_limit && completions == other.completions && manual_selector == other.manual_selector && parallelism == other.parallelism && selector == other.selector && template == other.template && ttl_seconds_after_finished == other.ttl_seconds_after_finished end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 174 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = Kubernetes.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 241 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 150 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) send("#{key}=", attributes[self.class.attribute_map[key]].map do |v| _deserialize(Regexp.last_match(1), v) end) end elsif !attributes[self.class.attribute_map[key]].nil? send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(other) ⇒ Boolean
136 137 138 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 136 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
142 143 144 145 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 142 def hash [active_deadline_seconds, backoff_limit, completions, manual_selector, parallelism, selector, template, ttl_seconds_after_finished].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
101 102 103 104 105 106 107 108 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 101 def list_invalid_properties invalid_properties = [] if @template.nil? invalid_properties.push("invalid value for 'template', template cannot be nil.") end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
220 221 222 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 220 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
226 227 228 229 230 231 232 233 234 235 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 226 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
214 215 216 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 214 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
112 113 114 115 116 |
# File 'lib/kubernetes/models/v1_job_spec.rb', line 112 def valid? return false if @template.nil? true end |