Class: Ocak::PipelineRunner

Inherits:
Object
  • Object
show all
Includes:
MergeOrchestration
Defined in:
lib/ocak/pipeline_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:, options: {}) ⇒ PipelineRunner

Returns a new instance of PipelineRunner.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ocak/pipeline_runner.rb', line 15

def initialize(config:, options: {})
  @config = config
  @options = options
  @watch_formatter = options[:watch] ? WatchFormatter.new : nil
  @shutting_down = false
  @shutdown_count = 0
  @active_issues = []
  @interrupted_issues = []
  @active_mutex = Mutex.new
  @registry = ProcessRegistry.new
  @executor = PipelineExecutor.new(config: config, shutdown_check: -> { @shutting_down })
end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



13
14
15
# File 'lib/ocak/pipeline_runner.rb', line 13

def registry
  @registry
end

Instance Method Details



51
52
53
54
55
56
57
58
59
# File 'lib/ocak/pipeline_runner.rb', line 51

def print_shutdown_summary
  issues = @active_mutex.synchronize { @interrupted_issues.dup }
  return if issues.empty?

  warn "\nInterrupted issues:"
  issues.each do |issue_number|
    warn "  - Issue ##{issue_number}: ocak resume --issue #{issue_number}"
  end
end

#runObject



28
29
30
# File 'lib/ocak/pipeline_runner.rb', line 28

def run
  @options[:single] ? run_single(@options[:single]) : run_loop
end

#run_pipeline(issue_number, logger:, claude:, chdir: nil, skip_steps: [], complexity: 'full') ⇒ Object



32
33
34
35
# File 'lib/ocak/pipeline_runner.rb', line 32

def run_pipeline(issue_number, logger:, claude:, chdir: nil, skip_steps: [], complexity: 'full')
  @executor.run_pipeline(issue_number, logger: logger, claude: claude, chdir: chdir,
                                       skip_steps: skip_steps, complexity: complexity)
end

#shutdown!Object



37
38
39
40
41
42
43
44
45
# File 'lib/ocak/pipeline_runner.rb', line 37

def shutdown!
  count = @active_mutex.synchronize { @shutdown_count += 1 }

  if count >= 2
    force_shutdown!
  else
    graceful_shutdown!
  end
end

#shutting_down?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/ocak/pipeline_runner.rb', line 47

def shutting_down?
  @shutting_down
end