Sha256: dc7276dabe998fb2ec08977641c7690ef29ba54065845825cd85566e7ab447c4

Contents?: true

Size: 1019 Bytes

Versions: 20

Compression:

Stored size: 1019 Bytes

Contents

#!/usr/bin/env ruby

example_description = <<DESC
  Sub Plans Example
  ===================

  This example shows, how to trigger the execution plans from within a
  run method of some action and waing for them to finish.

  This is useful, when doing bulk actions, where having one big
  execution plan would not be effective, or in case all the data are
  not available by the time of original action planning.

DESC

require_relative 'example_helper'
require_relative 'orchestrate_evented'


class SubPlansExample < Dynflow::Action
  include Dynflow::Action::WithSubPlans

  def create_sub_plans
    10.times.map { |i| trigger(OrchestrateEvented::CreateMachine, "host-#{i}", 'web_server') }
  end
end

if $0 == __FILE__
  triggered = ExampleHelper.world.trigger(SubPlansExample)
  puts example_description
  puts <<-MSG.gsub(/^.*\|/, '')
    |  Execution plan #{triggered.id} with sub plans triggered
    |  You can see the details at http://localhost:4567/#{triggered.id}
  MSG

  ExampleHelper.run_web_console
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
dynflow-0.8.16 examples/sub_plans.rb
dynflow-0.8.15 examples/sub_plans.rb
dynflow-0.8.14 examples/sub_plans.rb
dynflow-0.8.13 examples/sub_plans.rb
dynflow-0.8.12 examples/sub_plans.rb
dynflow-0.8.11 examples/sub_plans.rb
dynflow-0.8.10 examples/sub_plans.rb
dynflow-0.8.9 examples/sub_plans.rb
dynflow-0.8.8 examples/sub_plans.rb
dynflow-0.8.7 examples/sub_plans.rb
dynflow-0.8.6 examples/sub_plans.rb
dynflow-0.8.5 examples/sub_plans.rb
dynflow-0.8.4 examples/sub_plans.rb
dynflow-0.8.3 examples/sub_plans.rb
dynflow-0.8.2 examples/sub_plans.rb
dynflow-0.8.1 examples/sub_plans.rb
dynflow-0.8.0 examples/sub_plans.rb
dynflow-0.7.9 examples/sub_plans.rb
dynflow-0.7.8 examples/sub_plans.rb
dynflow-0.7.7 examples/sub_plans.rb