Class: StackMate::StackExecutor

Inherits:
Stacker
  • Object
show all
Includes:
Logging
Defined in:
lib/stackmate/stack_executor.rb

Instance Method Summary collapse

Methods included from Logging

configure_logger_for, #logger, logger_for

Methods inherited from Stacker

#find_refs, #resolve_dependencies, #resolve_param_refs, #tsort_each_child, #tsort_each_node, #validate_param_values

Constructor Details

#initialize(templatefile, stackname, params, engine, create_wait_conditions) ⇒ StackExecutor



14
15
16
17
18
# File 'lib/stackmate/stack_executor.rb', line 14

def initialize(templatefile, stackname, params, engine, create_wait_conditions)
    super(templatefile, stackname, params)
    @engine = engine
    @create_wait_conditions = create_wait_conditions
end

Instance Method Details

#launchObject



44
45
46
47
48
# File 'lib/stackmate/stack_executor.rb', line 44

def launch
    wfid = @engine.launch( pdef, @templ)
    @engine.wait_for(wfid)
    logger.error { "engine error : #{@engine.errors.first.message}"} if @engine.errors.first
end

#pdefObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/stackmate/stack_executor.rb', line 20

def pdef
    participants = self.strongly_connected_components.flatten
    #if we want to skip creating wait conditions (useful for automated tests)
    participants = participants.select { |p|
        StackMate.class_for(@templ['Resources'][p]['Type']) != 'StackMate::WaitCondition'
    } if !@create_wait_conditions

    logger.info("Ordered list of participants: #{participants}")

    participants.each do |p|
        t = @templ['Resources'][p]['Type']
        throw :unknown, t if !StackMate.class_for(t)
        @engine.register_participant p, StackMate.class_for(t)
    end

    @engine.register_participant 'Output', 'StackMate::Output'
    participants << 'Output'
    @pdef = Ruote.define @stackname.to_s() do
        cursor do
            participants.collect{ |name| __send__(name) }
        end
    end
end