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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pipeline_id) ⇒ LivePipeline

Returns a new instance of LivePipeline.



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

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 Attribute Details

#pipeline_idObject (readonly)

Returns the value of attribute pipeline_id.



7
8
9
# File 'lib/pipely/live_pipeline.rb', line 7

def pipeline_id
  @pipeline_id
end

Instance Method Details



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

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

#render_graphs(output_path = nil) ⇒ Object



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

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



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

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