class Pipely::Definition

Pipely’s representation of a Pipeline Definition for AWS Data Pipeline amzn.to/1bpW8Ru

Constants

NON_GRAPH_COMPONENT_TYPES

Showing all component types leads to an unwieldy graph. TODO: make this list configurable.

Attributes

components[R]

Public Class Methods

new(components) click to toggle source
# File lib/pipely/definition.rb, line 29
def initialize(components)
  @components = components
end
parse(content) click to toggle source
# File lib/pipely/definition.rb, line 22
def self.parse(content)
  objects = JSON.parse(content)['objects']
  components = objects.map{|obj| Component.new(obj)}

  new(components)
end

Public Instance Methods

apply_component_attributes(component_attributes) click to toggle source
# File lib/pipely/definition.rb, line 45
def apply_component_attributes(component_attributes)
  self.components.each do |component|
    if attributes = component_attributes[component.id]
      component.attributes = attributes
    end
  end
end
components_for_graph() click to toggle source
# File lib/pipely/definition.rb, line 35
def components_for_graph
  components.reject { |component|
    NON_GRAPH_COMPONENT_TYPES.include?(component['type'])
  }
end
to_json() click to toggle source
# File lib/pipely/definition.rb, line 41
def to_json
  { :objects => components }.to_json
end

Private Instance Methods

dependencies_of(selected_components) click to toggle source
# File lib/pipely/definition.rb, line 61
def dependencies_of(selected_components)
  all_dependencies = selected_components.map { |component|
    component.dependencies(:all)
  }.flatten.uniq

  Set.new(get_components(all_dependencies.map(&:target_id)))
end
get_components(target_component_ids) click to toggle source
# File lib/pipely/definition.rb, line 55
def get_components(target_component_ids)
  components.select { |component|
    target_component_ids.include?(component.id)
  }
end