Class: Pipely::LivePipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/pipely/live_pipeline.rb

Overview

Represent a pipeline that has been deployed to AWS DataPipeline

Instance Method Summary collapse

Constructor Details

#initialize(pipeline_id) ⇒ LivePipeline

Returns a new instance of LivePipeline.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pipely/live_pipeline.rb', line 8

def initialize(pipeline_id)
  @pipeline_id = pipeline_id

  @definition_json = definition(pipeline_id)
  @task_states_by_scheduled_start = task_states_by_scheduled_start

  unless @definition_json
    raise "No definition found for #{client.pipeline_id}"
  end

  if @task_states_by_scheduled_start.empty?
    raise "No runs found for #{client.pipeline_id}"
  end
end

Instance Method Details



23
24
25
# File 'lib/pipely/live_pipeline.rb', line 23

def print_runs_report
  RunsReport.new(@task_states_by_scheduled_start).print
end

#render_graphs(output_path = nil) ⇒ Object



33
34
35
36
37
# File 'lib/pipely/live_pipeline.rb', line 33

def render_graphs(output_path=nil)
  @task_states_by_scheduled_start.map do |start, task_states|
    render_graph(start, task_states, output_path)
  end
end

#render_latest_graph(output_path = nil) ⇒ Object



27
28
29
30
31
# File 'lib/pipely/live_pipeline.rb', line 27

def render_latest_graph(output_path=nil)
  latest_start = @task_states_by_scheduled_start.keys.max
  task_states = @task_states_by_scheduled_start[latest_start]
  render_graph(latest_start, task_states, output_path)
end