Class: FunCi::Pipeline::BackgroundWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/fun_ci/pipeline/background_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(recorder:, job_id:, executor:) ⇒ BackgroundWrapper

Returns a new instance of BackgroundWrapper.



6
7
8
9
10
# File 'lib/fun_ci/pipeline/background_wrapper.rb', line 6

def initialize(recorder:, job_id:, executor:)
  @recorder = recorder
  @job_id = job_id
  @executor = executor
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fun_ci/pipeline/background_wrapper.rb', line 12

def run
  _output, status, timed_out = @executor.call
  if timed_out
    @recorder.end_stage(@job_id, "timed_out")
    @recorder.fail_run
  elsif status.success?
    @recorder.end_stage(@job_id, "completed")
    @recorder.complete_run
  else
    @recorder.end_stage(@job_id, "failed")
    @recorder.fail_run
  end
end