| 1 | # -*- coding: utf-8 -*-
|
|---|
| 2 | defProperty('contr', 'node2-1', 'WiSHFUL Controller Node')
|
|---|
| 3 | defProperty('agent', 'node1-1', 'WiSHUL Agent Node')
|
|---|
| 4 | defProperty('path','/root/wishful/examples/simple/',"Path to WiSHFUL configuration directory")
|
|---|
| 5 | defProperty('duration', 60, "Seconds to run the application")
|
|---|
| 6 |
|
|---|
| 7 | defApplication('controller') do |app|
|
|---|
| 8 | app.description = 'WiSHFUL Simple Controller Program'
|
|---|
| 9 | app.path = property.path+'wishful_simple_controller'
|
|---|
| 10 | app.defProperty('config', 'Configuration file', '--config', {:type => :string})
|
|---|
| 11 | end
|
|---|
| 12 |
|
|---|
| 13 | defApplication('agent') do |app|
|
|---|
| 14 | app.description = 'WiSHFUL Simple Agent Program'
|
|---|
| 15 | app.path = property.path+'wishful_simple_agent'
|
|---|
| 16 | app.defProperty('config', 'Configuration file', '--config', {:type => :string})
|
|---|
| 17 | end
|
|---|
| 18 |
|
|---|
| 19 | defGroup( 'Controllers', property.contr ) do |node|
|
|---|
| 20 | info "Controller will be on #{property.contr}."
|
|---|
| 21 | node.addApplication( "controller" ) do |app|
|
|---|
| 22 | app.setProperty('config', property.path+'controller_config.yaml')
|
|---|
| 23 | end
|
|---|
| 24 | end
|
|---|
| 25 |
|
|---|
| 26 | defGroup( 'Agents', property.agent ) do |node|
|
|---|
| 27 | info "Agent will be on #{property.agent}."
|
|---|
| 28 | node.addApplication( "agent" ) do |app|
|
|---|
| 29 | app.setProperty('config', property.path+'agent_config.yaml')
|
|---|
| 30 | end
|
|---|
| 31 | end
|
|---|
| 32 |
|
|---|
| 33 | onEvent(:ALL_UP_AND_INSTALLED) do |event|
|
|---|
| 34 | info "Wait for all nodes to come up"
|
|---|
| 35 | wait 10
|
|---|
| 36 | allGroups.startApplications
|
|---|
| 37 | info "Both controller and agent started..."
|
|---|
| 38 | wait property.duration
|
|---|
| 39 | allGroups.stopApplications
|
|---|
| 40 | info "Both controller and agent stopped..."
|
|---|
| 41 | Experiment.done
|
|---|
| 42 | end
|
|---|
| 43 |
|
|---|