class Pipely::Component
Represents a Component
within a Data Pipeline Definition
amzn.to/16lbBKx
Constants
- REFERENCE_KEYS
- STATE_COLORS
Public Class Methods
new(args)
click to toggle source
Calls superclass method
# File lib/pipely/component.rb, line 48 def initialize(args) @original_args = args.clone super coerce_references end
Public Instance Methods
coerce_references()
click to toggle source
# File lib/pipely/component.rb, line 54 def coerce_references REFERENCE_KEYS.each do |key| value = send(key) unless value.is_a?(ReferenceList) send("#{key}=", ReferenceList.new(value)) end end end
dependencies(scope=nil)
click to toggle source
# File lib/pipely/component.rb, line 73 def dependencies(scope=nil) deps = dependsOn.build_dependencies('dependsOn') + precondition.build_dependencies('precondition') + input.build_dependencies('input') + output.build_dependencies('output') if :all == scope deps += runsOn.build_dependencies(:runsOn) deps += schedule.build_dependencies(:schedule) deps += onFail.build_dependencies(:onFail) deps += onSuccess.build_dependencies(:onSuccess) deps += dataFormat.build_dependencies(:dataFormat) end deps end
graphviz_options()
click to toggle source
# File lib/pipely/component.rb, line 63 def graphviz_options { :shape => 'record', :label => "{#{label}}", :color => color || 'black', :fillcolor => STATE_COLORS[execution_state] || 'white', :style => 'filled', } end
to_json(options={}, depth=0)
click to toggle source
# File lib/pipely/component.rb, line 90 def to_json(options={}, depth=0) h = @original_args REFERENCE_KEYS.each do |key| value = send(key) if value.present? h[key] = value else h.delete(key) end end h.to_json(options) end
Private Instance Methods
label()
click to toggle source
# File lib/pipely/component.rb, line 108 def label [id, type, execution_state].compact.join('|') end