Class: SmplkitGeneratedClient::Jobs::Run

Inherits:
ApiModelBase show all
Defined in:
lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb

Overview

One occurrence of a job executing.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Run

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



164
165
166
167
168
169
170
171
172
173
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 164

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::Run` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::Run`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'job')
    self.job = attributes[:'job']
  else
    self.job = nil
  end

  if attributes.key?(:'job_version')
    self.job_version = attributes[:'job_version']
  end

  if attributes.key?(:'trigger')
    self.trigger = attributes[:'trigger']
  else
    self.trigger = nil
  end

  if attributes.key?(:'rerun_of')
    self.rerun_of = attributes[:'rerun_of']
  end

  if attributes.key?(:'scheduled_for')
    self.scheduled_for = attributes[:'scheduled_for']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

  if attributes.key?(:'started_at')
    self.started_at = attributes[:'started_at']
  end

  if attributes.key?(:'finished_at')
    self.finished_at = attributes[:'finished_at']
  end

  if attributes.key?(:'pending_duration_ms')
    self.pending_duration_ms = attributes[:'pending_duration_ms']
  end

  if attributes.key?(:'run_duration_ms')
    self.run_duration_ms = attributes[:'run_duration_ms']
  end

  if attributes.key?(:'total_duration_ms')
    self.total_duration_ms = attributes[:'total_duration_ms']
  end

  if attributes.key?(:'failure_reason')
    self.failure_reason = attributes[:'failure_reason']
  end

  if attributes.key?(:'error')
    self.error = attributes[:'error']
  end

  if attributes.key?(:'request')
    if (value = attributes[:'request']).is_a?(Hash)
      self.request = value
    end
  end

  if attributes.key?(:'result')
    if (value = attributes[:'result']).is_a?(Hash)
      self.result = value
    end
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end
end

Instance Attribute Details

#created_atObject

When the run was enqueued (became ‘PENDING`).



65
66
67
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 65

def created_at
  @created_at
end

#errorObject

Free-text failure detail, if any.



56
57
58
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 56

def error
  @error
end

#failure_reasonObject

Why a ‘FAILED` run failed; `null` otherwise.



53
54
55
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 53

def failure_reason
  @failure_reason
end

#finished_atObject

When execution finished.



41
42
43
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 41

def finished_at
  @finished_at
end

#jobObject

The slug of the job this run belongs to.



20
21
22
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 20

def job
  @job
end

#job_versionObject

The job’s version at the time the run executed.



23
24
25
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 23

def job_version
  @job_version
end

#pending_duration_msObject

Milliseconds the run waited as ‘PENDING` before starting.



44
45
46
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 44

def pending_duration_ms
  @pending_duration_ms
end

#requestObject

Snapshot of the request that was sent (header values redacted). Forensics only.



59
60
61
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 59

def request
  @request
end

#rerun_ofObject

The source run’s id; set only when ‘trigger` is `RERUN`.



29
30
31
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 29

def rerun_of
  @rerun_of
end

#resultObject

Outcome of the call. For ‘http`: `status`, `headers`, `body` (capped at 64 KiB), `body_truncated`, and the original `body_bytes`.



62
63
64
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 62

def result
  @result
end

#run_duration_msObject

Milliseconds the run spent executing.



47
48
49
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 47

def run_duration_ms
  @run_duration_ms
end

#scheduled_forObject

The intended fire time for a scheduled run; ‘null` for manual / rerun runs.



32
33
34
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 32

def scheduled_for
  @scheduled_for
end

#started_atObject

When execution started.



38
39
40
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 38

def started_at
  @started_at
end

#statusObject

Lifecycle state of the run.



35
36
37
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 35

def status
  @status
end

#total_duration_msObject

Milliseconds from enqueue to finish.



50
51
52
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 50

def total_duration_ms
  @total_duration_ms
end

#triggerObject

Why the run exists: ‘SCHEDULE`, `MANUAL` (Run now), or `RERUN`.



26
27
28
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 26

def trigger
  @trigger
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



112
113
114
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 112

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



117
118
119
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 117

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 90

def self.attribute_map
  {
    :'job' => :'job',
    :'job_version' => :'job_version',
    :'trigger' => :'trigger',
    :'rerun_of' => :'rerun_of',
    :'scheduled_for' => :'scheduled_for',
    :'status' => :'status',
    :'started_at' => :'started_at',
    :'finished_at' => :'finished_at',
    :'pending_duration_ms' => :'pending_duration_ms',
    :'run_duration_ms' => :'run_duration_ms',
    :'total_duration_ms' => :'total_duration_ms',
    :'failure_reason' => :'failure_reason',
    :'error' => :'error',
    :'request' => :'request',
    :'result' => :'result',
    :'created_at' => :'created_at'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 367

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 144

def self.openapi_nullable
  Set.new([
    :'job_version',
    :'rerun_of',
    :'scheduled_for',
    :'started_at',
    :'finished_at',
    :'pending_duration_ms',
    :'run_duration_ms',
    :'total_duration_ms',
    :'failure_reason',
    :'error',
    :'request',
    :'result',
    :'created_at'
  ])
end

.openapi_typesObject

Attribute type mapping.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 122

def self.openapi_types
  {
    :'job' => :'String',
    :'job_version' => :'Integer',
    :'trigger' => :'String',
    :'rerun_of' => :'String',
    :'scheduled_for' => :'Time',
    :'status' => :'String',
    :'started_at' => :'Time',
    :'finished_at' => :'Time',
    :'pending_duration_ms' => :'Integer',
    :'run_duration_ms' => :'Integer',
    :'total_duration_ms' => :'Integer',
    :'failure_reason' => :'String',
    :'error' => :'String',
    :'request' => :'Hash<String, Object>',
    :'result' => :'Hash<String, Object>',
    :'created_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 331

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      job == o.job &&
      job_version == o.job_version &&
      trigger == o.trigger &&
      rerun_of == o.rerun_of &&
      scheduled_for == o.scheduled_for &&
      status == o.status &&
      started_at == o.started_at &&
      finished_at == o.finished_at &&
      pending_duration_ms == o.pending_duration_ms &&
      run_duration_ms == o.run_duration_ms &&
      total_duration_ms == o.total_duration_ms &&
      failure_reason == o.failure_reason &&
      error == o.error &&
      request == o.request &&
      result == o.result &&
      created_at == o.created_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


354
355
356
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 354

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



360
361
362
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 360

def hash
  [job, job_version, trigger, rerun_of, scheduled_for, status, started_at, finished_at, pending_duration_ms, run_duration_ms, total_duration_ms, failure_reason, error, request, result, created_at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 255

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @job.nil?
    invalid_properties.push('invalid value for "job", job cannot be nil.')
  end

  if @trigger.nil?
    invalid_properties.push('invalid value for "trigger", trigger cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 389

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb', line 275

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @job.nil?
  return false if @trigger.nil?
  trigger_validator = EnumAttributeValidator.new('String', ["SCHEDULE", "MANUAL", "RERUN"])
  return false unless trigger_validator.valid?(@trigger)
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["PENDING", "RUNNING", "SUCCEEDED", "FAILED", "CANCELED"])
  return false unless status_validator.valid?(@status)
  failure_reason_validator = EnumAttributeValidator.new('String', ["TIMEOUT", "CONNECTION_ERROR", "NON_SUCCESS_STATUS", "SSRF_BLOCKED", "QUOTA_EXCEEDED", "WORKER_LOST"])
  return false unless failure_reason_validator.valid?(@failure_reason)
  true
end