Class: Smplkit::Jobs::Run

Inherits:
Struct
  • Object
show all
Defined in:
lib/smplkit/jobs/models.rb

Overview

A single execution of a job (read-only).

Runs are created and mutated by the jobs service, not by clients; clients influence runs only through the run / cancel / rerun actions on client.jobs.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#created_atString?

Returns When the run was enqueued (became PENDING).

Returns:

  • (String, nil)

    When the run was enqueued (became PENDING).



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#errorString?

Returns Free-text failure detail, if any.

Returns:

  • (String, nil)

    Free-text failure detail, if any.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#failure_reasonString?

Returns Why a FAILED run failed; nil otherwise.

Returns:

  • (String, nil)

    Why a FAILED run failed; nil otherwise.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#finished_atString?

Returns When execution finished.

Returns:

  • (String, nil)

    When execution finished.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#idString

Returns Server-assigned UUID for this run.

Returns:

  • (String)

    Server-assigned UUID for this run.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#jobString

Returns The id of the job this run belongs to.

Returns:

  • (String)

    The id of the job this run belongs to.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#job_versionInteger?

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

Returns:

  • (Integer, nil)

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



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#pending_duration_msInteger?

Returns Milliseconds the run waited as PENDING before starting.

Returns:

  • (Integer, nil)

    Milliseconds the run waited as PENDING before starting.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#requestHash?

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

Returns:

  • (Hash, nil)

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



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#rerun_ofString?

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

Returns:

  • (String, nil)

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



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#resultHash?

Returns Outcome of the call (status, headers, body, …).

Returns:

  • (Hash, nil)

    Outcome of the call (status, headers, body, …).



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#run_duration_msInteger?

Returns Milliseconds the run spent executing.

Returns:

  • (Integer, nil)

    Milliseconds the run spent executing.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#scheduled_forString?

Returns The intended fire time for a scheduled run; nil for manual / rerun runs.

Returns:

  • (String, nil)

    The intended fire time for a scheduled run; nil for manual / rerun runs.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#started_atString?

Returns When execution started.

Returns:

  • (String, nil)

    When execution started.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#statusString

Returns Lifecycle state of the run.

Returns:

  • (String)

    Lifecycle state of the run.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#total_duration_msInteger?

Returns Milliseconds from enqueue to finish.

Returns:

  • (Integer, nil)

    Milliseconds from enqueue to finish.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

#triggerString

Returns Why the run exists: SCHEDULE, MANUAL (run now), or RERUN.

Returns:

  • (String)

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



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/smplkit/jobs/models.rb', line 369

Run = Struct.new(
  :id, :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,
  keyword_init: true
) do
  # @api private — Build a {Run} from a JSON:API resource returned by the
  #   jobs service.
  #
  # @param resource [Object] The JSON:API resource (id + attributes).
  # @return [Run] The hydrated run.
  def self.from_resource(resource)
    a = resource.attributes
    new(
      id: resource.id,
      job: a.job,
      job_version: a.job_version,
      trigger: a.trigger,
      rerun_of: a.rerun_of,
      scheduled_for: a.scheduled_for,
      status: a.status,
      started_at: a.started_at,
      finished_at: a.finished_at,
      pending_duration_ms: a.pending_duration_ms,
      run_duration_ms: a.run_duration_ms,
      total_duration_ms: a.total_duration_ms,
      failure_reason: a.failure_reason,
      error: a.error,
      request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
      result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
      created_at: a.created_at
    )
  end
end

Class Method Details

.from_resource(resource) ⇒ Run

Returns The hydrated run.

Parameters:

  • resource (Object)

    The JSON:API resource (id + attributes).

Returns:

  • (Run)

    The hydrated run.



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/smplkit/jobs/models.rb', line 380

def self.from_resource(resource)
  a = resource.attributes
  new(
    id: resource.id,
    job: a.job,
    job_version: a.job_version,
    trigger: a.trigger,
    rerun_of: a.rerun_of,
    scheduled_for: a.scheduled_for,
    status: a.status,
    started_at: a.started_at,
    finished_at: a.finished_at,
    pending_duration_ms: a.pending_duration_ms,
    run_duration_ms: a.run_duration_ms,
    total_duration_ms: a.total_duration_ms,
    failure_reason: a.failure_reason,
    error: a.error,
    request: a.request.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.request),
    result: a.result.nil? ? nil : Smplkit::Helpers.deep_stringify_keys(a.result),
    created_at: a.created_at
  )
end