lib/elasticity/job_flow_step.rb in elasticity-1.5 vs lib/elasticity/job_flow_step.rb in elasticity-2.0
- old
+ new
@@ -1,34 +1,26 @@
module Elasticity
- class JobFlowStep
+ module JobFlowStep
- attr_accessor :name
- attr_accessor :state
- attr_accessor :started_at
- attr_accessor :ended_at
-
- # Create a job flow from an AWS <member> (Nokogiri::XML::Element):
- # /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member/Steps/member
- def self.from_member_element(xml_element)
- job_flow_step = JobFlowStep.new
- job_flow_step.name = xml_element.xpath("./StepConfig/Name").text.strip
- job_flow_step.state = xml_element.xpath("./ExecutionStatusDetail/State").text.strip
- started_at = xml_element.xpath("./ExecutionStatusDetail/StartDateTime").text.strip
- job_flow_step.started_at = (started_at == "") ? (nil) : (Time.parse(started_at))
- ended_at = xml_element.xpath("./ExecutionStatusDetail/EndDateTime").text.strip
- job_flow_step.ended_at = (ended_at == "") ? (nil) : (Time.parse(ended_at))
- job_flow_step
+ def to_aws_step(jobflow_step)
+ raise RuntimeError, '#to_aws_step is required to be defined on all job flow steps.'
end
- # Create JobFlowSteps from a collection of AWS <member> nodes (Nokogiri::XML::NodeSet):
- # /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member/Steps/member
- def self.from_members_nodeset(members_nodeset)
- jobflow_steps = []
- members_nodeset.each do |member|
- jobflow_steps << from_member_element(member)
+ module ClassMethods
+
+ def requires_installation?
+ false
end
- jobflow_steps
+
+ def aws_installation_step
+ raise RuntimeError, '.aws_installation_step is required to be defined when a step requires installation (e.g. Pig, Hive).'
+ end
+
+ end
+
+ def self.included(base)
+ base.extend(ClassMethods)
end
end
end