Class: Pipely::LivePipeline
- Inherits:
-
Object
- Object
- Pipely::LivePipeline
- Defined in:
- lib/pipely/live_pipeline.rb
Overview
Represent a pipeline that has been deployed to AWS DataPipeline
Instance Method Summary collapse
-
#initialize(pipeline_id) ⇒ LivePipeline
constructor
A new instance of LivePipeline.
- #print_runs_report ⇒ Object
- #render_graphs ⇒ Object
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
#print_runs_report ⇒ Object
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 ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pipely/live_pipeline.rb', line 29 def render_graphs @task_states_by_scheduled_start.each do |start, task_states| utc_time = Time.now.to_i formatted_start = start.gsub(/[:-]/, '').sub('T', '-') filename = "graphs/#{@pipeline_id}-#{formatted_start}-#{utc_time}.png" if $stdout.tty? $stdout.puts "Generating #{filename}" else $stdout.puts filename end Pipely.draw(@definition_json, filename, task_states) end end |