From 01ac5c44efe8a43c105bb57827a68c0192c3f283 Mon Sep 17 00:00:00 2001 From: nshankar Date: Wed, 1 Nov 2006 19:25:36 +0000 Subject: Wed Nov 1 19:24:27 UTC 2006 Nishanth Shankaran --- ChangeLog | 6 ++ descriptors/run_all.pl | 158 ++++++++++++++++++++++++++++++++++++++++++++++ descriptors/run_ground.pl | 23 +++++++ descriptors/run_space.pl | 23 +++++++ 4 files changed, 210 insertions(+) create mode 100755 descriptors/run_all.pl create mode 100755 descriptors/run_ground.pl create mode 100755 descriptors/run_space.pl diff --git a/ChangeLog b/ChangeLog index 2ed3b56a56f..9de3e43bdab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Nov 1 19:24:27 UTC 2006 Nishanth Shankaran + + * descriptors/run_all.pl: + * descriptors/run_ground.pl: + * descriptors/run_space.pl: Added these startup scripts. + Wed Nov 1 18:58:45 UTC 2006 Nishanth Shankaran * SA_POP/Converter.h: diff --git a/descriptors/run_all.pl b/descriptors/run_all.pl new file mode 100755 index 00000000000..dc5a84f619b --- /dev/null +++ b/descriptors/run_all.pl @@ -0,0 +1,158 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# run_test.pl,v 1.5 2006/01/31 21:54:08 wotte Exp +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$DAnCE = "$ENV{'CIAO_ROOT'}/DAnCE"; +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; +$daemons = 3; +@ports = ( 50000, 50001, 50002, 50003, 50004,50005,50006,50007, 50008, 50009, 50010 ); +@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior", "NodeApp3.ior", "NodeApp4.ior", "NodeApp5.ior","NodeApp6.ior","NodeApp7.ior", "NodeApp8.ior", "NodeApp9.ior", "NodeApp10.ior", "NodeApp11.ior" ); +$status = 0; +$dat_file = "NodeDetails.dat"; +$cdp_file = "RACE.cdp"; + +$nsior = PerlACE::LocalFile ("ns.ior"); + +unlink $nsior; + +$E = 0; +$EM = 0; + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $daemons; ++$i) { + unlink $iorfiles[$i]; + } + unlink PerlACE::LocalFile ("EM.ior"); + unlink PerlACE::LocalFile ("Receiver.ior"); + unlink PerlACE::LocalFile ("Sender.ior"); + unlink PerlACE::LocalFile ("DAM.ior"); + unlink PerlACE::LocalFile ("ns.ior"); +} + +sub kill_node_daemons { + for ($i = 0; $i < $daemons; ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } + + if ($em_running == 1) { + $EM->Kill (); + $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); + $NS->TimedWait (1); + } + +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + + $iiop = "iiop://localhost:$port"; + $node_app = "$DAnCE/NodeApplication/NodeApplication"; + + $d_cmd = "$DAnCE/NodeManager/NodeManager"; + $d_param = "-n -ORBEndpoint $iiop -s $node_app -o $iorfile -d 60"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR + "ERROR: The ior file of node daemon $i could not be found\n"; + for (; $i > 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + $daemons_running = 1; + return 0; +} + +delete_ior_files (); + +# Invoke naming service + +$NS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 0 -ORBEndpoint iiop://localhost:40003 -o ns.ior"); + +$NS->Spawn (); + + print STDERR "Starting Naming Service\n"; + + if (PerlACE::waitforfile_timed ($nsior, 10) == -1) + { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); + exit 1; + } + +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:40003/NameService"; + +# Invoke node daemons. +print "Invoking node daemons\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + exit 1; +} + +$ns_running = 1; + +# Invoke execution manager. +print "Invoking execution manager\n"; + $EM = new PerlACE::Process ("$DAnCE/ExecutionManager/Execution_Manager", + "-n -o EM.ior -i $dat_file"); + $EM->Spawn (); + + if (PerlACE::waitforfile_timed ("EM.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; + } + +$em_running = 1; + +# print " Invoke executor - start the application -." +print "Invoking executor - start the application -\n"; +$E = + new PerlACE::Process ("$DAnCE/Plan_Launcher/plan_launcher", + "-p $cdp_file -k file://EM.ior"); + +$E->SpawnWaitKill (5000); + + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/descriptors/run_ground.pl b/descriptors/run_ground.pl new file mode 100755 index 00000000000..aa4639ab196 --- /dev/null +++ b/descriptors/run_ground.pl @@ -0,0 +1,23 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# run_test.pl,v 1.5 2006/01/31 21:54:08 wotte Exp +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$DAnCE = "$ENV{'CIAO_ROOT'}/DAnCE"; +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; + +$iiop = "iiop://localhost:50002"; +$node_app = "$DAnCE/NodeApplication/NodeApplication"; +$d_cmd = "$DAnCE/NodeManager/NodeManager"; +$iorfile = "Groung.ior"; +$d_param = "-n -ORBEndpoint $iiop -s $node_app -o $iorfile -d 60"; +$space = new PerlACE::Process ($d_cmd, $d_param); +$space->SpawnWaitKill (5000); + +exit 0; diff --git a/descriptors/run_space.pl b/descriptors/run_space.pl new file mode 100755 index 00000000000..2efe9d607cf --- /dev/null +++ b/descriptors/run_space.pl @@ -0,0 +1,23 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# run_test.pl,v 1.5 2006/01/31 21:54:08 wotte Exp +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$DAnCE = "$ENV{'CIAO_ROOT'}/DAnCE"; +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; + +$iiop = "iiop://localhost:50001"; +$node_app = "$DAnCE/NodeApplication/NodeApplication"; +$d_cmd = "$DAnCE/NodeManager/NodeManager"; +$iorfile = "SPACE.ior"; +$d_param = "-n -ORBEndpoint $iiop -s $node_app -o $iorfile -d 60"; +$space = new PerlACE::Process ($d_cmd, $d_param); +$space->SpawnWaitKill (5000); + +exit 0; -- cgit v1.2.1