Class: JobWorkflow::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/job_workflow/runner.rb

Overview

rubocop:disable Metrics/ClassLength

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context:) ⇒ Runner

: (context: Context) -> void



8
9
10
11
# File 'lib/job_workflow/runner.rb', line 8

def initialize(context:)
  @context = context
  @job = context._job || (raise "current job is not set in context")
end

Instance Attribute Details

#contextObject (readonly)

: Context



5
6
7
# File 'lib/job_workflow/runner.rb', line 5

def context
  @context
end

Instance Method Details

#runObject

: () -> void



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/job_workflow/runner.rb', line 14

def run
  task = context._task_context.task
  if !task.nil? && context.sub_job?
    run_task(task)
    persist_current_job_context
    return
  end

  catch(:rescheduled) { run_workflow }
  persist_current_job_context
end