diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-11-19 08:01:06 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-11-19 08:01:06 +0000 |
commit | daff239387258a93c96d1b8b39dbc79eb887ca52 (patch) | |
tree | 723060f4e13b505a3dc7d2d1c127bc07e9b10392 | |
parent | 7d3f850d0ecf7a214cffd36ad7a91a93b5b4ee5b (diff) | |
download | ATCD-daff239387258a93c96d1b8b39dbc79eb887ca52.tar.gz |
ChangeLogTag:Wed Nov 19 00:56:46 2003 Nanbor Wang <nanbor@cse.wustl.edu>
-rw-r--r-- | TAO/CIAO/ChangeLog | 13 | ||||
-rw-r--r-- | TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp | 163 | ||||
-rw-r--r-- | TAO/CIAO/tools/Assembly_Deployer/README | 37 |
3 files changed, 159 insertions, 54 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 2bf3335548e..b02f852c2a7 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,16 @@ +Wed Nov 19 00:56:46 2003 Nanbor Wang <nanbor@cse.wustl.edu> + + * tools/Assembly_Deployer/README: + * tools/Assembly_Deployer/Assembly_Deployer.cpp: I'm in the + process of disect the program into a command line tool that can + either build or teardown an assembly with each invocation. + Right now, you run an application to completion each time you + invoke the deployer, with a manual keystroke indicating the + tearing down of the application. This change will make it much + easier to write test script that can be shutdown cleanly. + + Not yet finished. + Sun Nov 16 20:27:19 2003 Nanbor Wang <nanbor@cs.wustl.edu> * Priority_Test/Workers/CB_Worker_exec.cpp: Fixed a g++ diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp index 27249e2925d..aa6032190e7 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp @@ -9,12 +9,15 @@ const char *ior = "file://test.ior"; const char *cad = 0; +const char *cookie_output = 0; +const char *cookie_teardown = 0; int benchmark = 0; +int shutdown_server = 0; int parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "a:k:t"); + ACE_Get_Opt get_opts (argc, argv, "a:k:o:d:tx"); int c; while ((c = get_opts ()) != -1) @@ -32,27 +35,116 @@ parse_args (int argc, char *argv[]) ior = get_opts.opt_arg (); break; + case 'o': + cookie_output = get_opts.opt_arg (); + break; + + case 'd': + cookie_teardown = get_opts.opt_arg (); + break; + + case 'x': + shutdown_server = 1; + break; + case '?': default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s \n" "-a <assembly descriptor (.cad)>\n" "-t: turn on deployment timer\n" + "-o <filename for outputing assembled cookie>" + "-d <filename for cookie to be teardown'ed>" "-k <Assembly_Manager ior> \n" "\n", argv [0]), -1); } - if (cad == 0) + if (cookie_output != 0) + { + if (cad == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Must specify an assembly descriptor using -a flag.\n"), + -1); + } + else if (cookie_teardown == 0) ACE_ERROR_RETURN ((LM_ERROR, - "Must specify an assembly descriptor using -a flag.\n"), + "Must specify to build or teardown an assembly using -o or -d flage.\n"), -1); // Indicates sucessful parsing of the command line return 0; } +void +create_assembly (Components::Deployment::AssemblyFactory_ptr *factory + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + ACE_DEBUG ((LM_DEBUG, "Creating an Assembly with %s\n", cad)); + + make_assembly.start (); // Start measuring the time to parse a + // cad file and create an assembly object. + Components::Cookie_var ck = + factory->create_assembly (cad + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + make_assembly.stop (); // Stop measuring + + Components::Deployment::Assembly_var assembly = + factory->lookup (ck.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + build_assembly.start (); // Start measuring the time to + // instantiate and connect the + // application. + assembly->build (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + build_assembly.stop (); + overall.stop (); + + if (benchmark != 0) + { + ACE_Time_Value overall_time, make_time, build_time; + overall.elapsed_time (overall_time); + make_assembly.elapsed_time (make_time); + build_assembly.elapsed_time (build_time); + + ACE_DEBUG ((LM_DEBUG, + "Total deployment time: %d.%06d sec\n" + " create assembly time: %d.%06d sec\n" + " build assembly time: %d.%06d sec\n", + overall_time.sec (), overall_time.usec (), + make_time.sec (), make_time.usec (), + build_time.sec (), build_time.usec ())); + } + + // Output Cookie value here. + +} + +void +teardown_assembly (Components::Deployment::AssemblyFactory_ptr *factory + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + // Extract and restore Cookie value (ck) here. + + // Look up the assembly from the factory. + Components::Deployment::Assembly_var assembly = + factory->lookup (ck.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + assembly->tear_down (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + factory->destroy (ck.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + +} + int main (int argc, char *argv[]) { @@ -100,59 +192,22 @@ main (int argc, char *argv[]) 1); } - - ACE_DEBUG ((LM_DEBUG, "Creating an Assembly with %s\n", cad)); - - make_assembly.start (); // Start measuring the time to parse a - // cad file and create an assembly object. - Components::Cookie_var ck = - factory->create_assembly (cad - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - make_assembly.stop (); // Stop measuring - - Components::Deployment::Assembly_var assembly = - factory->lookup (ck.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - build_assembly.start (); // Start measuring the time to - // instantiate and connect the - // application. - assembly->build (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - build_assembly.stop (); - overall.stop (); - - if (benchmark != 0) + if (cookie_output != 0) { - ACE_Time_Value overall_time, make_time, build_time; - overall.elapsed_time (overall_time); - make_assembly.elapsed_time (make_time); - build_assembly.elapsed_time (build_time); - - ACE_DEBUG ((LM_DEBUG, - "Total deployment time: %d.%06d sec\n" - " create assembly time: %d.%06d sec\n" - " build assembly time: %d.%06d sec\n", - overall_time.sec (), overall_time.usec (), - make_time.sec (), make_time.usec (), - build_time.sec (), build_time.usec ())); + create_assembly (factory.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else if (cookie_teardown != 0) + { + teardown_assembly (factory.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (shutdown_server != 0) // can only shutdown when tearing down stuff. + { + as_svc->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } } - - ACE_DEBUG ((LM_DEBUG, "Press <enter> to tear down the assembly\n")); - char dummy [256]; - cin.getline (dummy, 256); - - assembly->tear_down (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - factory->destroy (ck.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - as_svc->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/CIAO/tools/Assembly_Deployer/README b/TAO/CIAO/tools/Assembly_Deployer/README new file mode 100644 index 00000000000..61690fa971e --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/README @@ -0,0 +1,37 @@ +// $Id$ -*- Outline -*- + +* Assembly_Manager + + Assembly_Manager is the daemon process for the assembly framework. + It contains the knowledge of "deployment topology". + + Usage: + + Assembly_Manager -c <deployment configuration file> -o <ior_output_file> + + The deployment configuration file contain the mapping from logical + host name to actual target name, in corbaloc IOR format. + + +* Assembly_Deployer + + Assembly_Deployer is the controlling program for Assembly_Manager. + You can use Assembly_Deployer to deploy and start up an application + assembly or to tear down a running application assembly. + + Usage: + + To deploy an assembly: + + Assembly_Deployer -k <ior to Assembly_Manager> \ + -a <assembly descriptor filename> \ + -t <benchmark assembly deployment time> \ + -o <filename to write assembly id to> + + To teardown an assembly: + + Assembly_Deployer -k <ior to Assembly_Manager> \ + [-d <filename containing assembly id>] + [-x] + + -x can be used optionally to shutdown the manager. |