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.



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

def initialize(pipeline_id)
  @pipeline_id = pipeline_id

  client = FogClient.new(pipeline_id)
  @definition_json = client.definition
  @task_states_by_scheduled_start = client.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



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

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

#render_graphs(output_path = nil) ⇒ Object



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

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



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

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