diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2011-11-25 20:05:38 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2011-11-25 20:05:38 +0000 |
commit | 443cade4654861a13daa84cde5223555322a7ac7 (patch) | |
tree | 9a9cf571104f8b28fa3bd884eeff862dd653c16e | |
parent | cc50de188144be13755327fa5969089a06ceab76 (diff) | |
download | ATCD-443cade4654861a13daa84cde5223555322a7ac7.tar.gz |
4 files changed, 165 insertions, 27 deletions
diff --git a/DAnCE/dance/NodeApplication/NodeApplication_Impl.cpp b/DAnCE/dance/NodeApplication/NodeApplication_Impl.cpp index 6b61a7621a8..1b517b46e51 100644 --- a/DAnCE/dance/NodeApplication/NodeApplication_Impl.cpp +++ b/DAnCE/dance/NodeApplication/NodeApplication_Impl.cpp @@ -58,15 +58,13 @@ NodeApplication_Impl::NodeApplication_Impl (CORBA::ORB_ptr orb, this->scheduler_.activate_scheduler (0); timer_out_.open (node_name_.c_str (), - std::ios_base::out & std::ios_base::trunc); + std::ios_base::out & ios_base::app); timer_.reset (); - timer_.start (); } NodeApplication_Impl::~NodeApplication_Impl() { DANCE_TRACE( "NodeApplication_Impl::~NodeApplication_Impl()"); - timer_.stop (); timer_out_.close (); this->scheduler_.terminate_scheduler (); } @@ -76,9 +74,8 @@ NodeApplication_Impl::prepare_instances (const LocalitySplitter::TSubPlans& plan { DANCE_TRACE ("NodeApplication_Impl::prepare_instances"); - ACE_hrtime_t time (0); - timer_.elapsed_microseconds (time); - timer_out_ << "prepare_instances start:" << time << '\n'; + timer_.reset (); + timer_.start (); CORBA::ULong plan (0); std::list < Event_Future > prepared_instances; @@ -212,9 +209,13 @@ NodeApplication_Impl::prepare_instances (const LocalitySplitter::TSubPlans& plan ACE_TEXT ("Successfully executed preparePlan on locality %C\n"), event.id_.c_str ())); } - - timer_.elapsed_microseconds (time); - timer_out_ << "prepare_instances end:" << time << '\n'; + + timer_.stop (); + + ACE_hrtime_t elapsed (0); + timer_.elapsed_microseconds (elapsed); + timer_out_ << "PreparePlan time: " << elapsed << '\n'; + } void @@ -262,9 +263,8 @@ void NodeApplication_Impl::start_launch_instances (const Deployment::Properties &prop, Deployment::Connections_out providedReference) { - ACE_hrtime_t time (0); - timer_.elapsed_microseconds (time); - timer_out_ << "start_launch_instances start:" << time << '\n'; + timer_.reset (); + timer_.start (); DANCE_TRACE ("NodeApplication_Impl::start_launch_instances"); Deployment::Connections *tmp (0); @@ -332,17 +332,19 @@ NodeApplication_Impl::start_launch_instances (const Deployment::Properties &prop } } - timer_.elapsed_microseconds (time); - timer_out_ << "start_launch_instances end:" << time << '\n'; + timer_.stop (); + + ACE_hrtime_t elapsed (0); + timer_.elapsed_microseconds (elapsed); + timer_out_ << "StartLaunch time: " << elapsed << '\n'; } void NodeApplication_Impl::finishLaunch (const ::Deployment::Connections & providedReference, ::CORBA::Boolean start) { - ACE_hrtime_t time (0); - timer_.elapsed_microseconds (time); - timer_out_ << "finishLaunch start:" << time << '\n'; + timer_.reset (); + timer_.start (); DANCE_TRACE ("NodeApplication_Impl::finishLaunch"); @@ -371,17 +373,19 @@ NodeApplication_Impl::finishLaunch (const ::Deployment::Connections & providedRe throw; } } - - timer_.elapsed_microseconds (time); - timer_out_ << "finishLaunch end:" << time << '\n'; + + timer_.stop (); + + ACE_hrtime_t elapsed (0); + timer_.elapsed_microseconds (elapsed); + timer_out_ << "FinishLaunch time: " << elapsed << '\n'; } void NodeApplication_Impl::start () { - ACE_hrtime_t time (0); - timer_.elapsed_microseconds (time); - timer_out_ << "start start:" << time << '\n'; + timer_.reset (); + timer_.start (); DANCE_TRACE( "NodeApplication_Impl::start"); @@ -408,8 +412,13 @@ NodeApplication_Impl::start () throw; } } - timer_.elapsed_microseconds (time); - timer_out_ << "start end:" << time << '\n'; + + timer_.stop (); + + ACE_hrtime_t elapsed (0); + timer_.elapsed_microseconds (elapsed); + timer_out_ << "start time: " << elapsed << '\n'; + } void diff --git a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.cpp b/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.cpp index fff358447ba..e4ede2be34f 100644 --- a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.cpp +++ b/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.cpp @@ -128,8 +128,22 @@ NodeApplicationManager_Impl::preparePlan (const Deployment::DeploymentPlan& plan ACE_TEXT("Performing locality split on plan %C.\n"), plan.UUID.in ())); + std::ofstream timer_out_; + timer_out_.open (node_name_.c_str (), + std::ios_base::out & std::ios_base::trunc); + ACE_High_Res_Timer timer_; + timer_.reset (); + timer_.start (); + this->split_plan_.split_plan (plan); + ACE_hrtime_t elapsed (0); + timer_.elapsed_microseconds (elapsed); + timer_out_ << "Local split plan time: " << elapsed << '\n'; + + timer_out_.close (); + + DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_TRACE, DLINFO ACE_TEXT("NodeApplicationManager_impl::preparePlan - ") diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher.cpp b/DAnCE/dance/Plan_Launcher/Plan_Launcher.cpp index d4ab078fb63..68b0a676ca1 100644 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher.cpp +++ b/DAnCE/dance/Plan_Launcher/Plan_Launcher.cpp @@ -30,6 +30,7 @@ namespace STARTLAUNCH, FINISHLAUNCH, START, + STOPAPP, TEARDOWN, INVALID }; @@ -119,6 +120,8 @@ usage(const ACE_TCHAR*) ACE_TEXT ("\t-s|--stop-plan\t\t\tStop the plan ") ACE_TEXT ("(Requires Plan, UUID, or APP/AM references\n") + ACE_TEXT ("\t--stop-application\t\t\tStop an application, but not destroy DAM\n") + ACE_TEXT ("\t-f|--force\t\t\tDo not stop teardown on errors") ACE_TEXT ("\nOther Options\n") @@ -164,6 +167,7 @@ parse_args(int argc, ACE_TCHAR *argv[], Options &options) get_opt.long_option(ACE_TEXT("manager-timeout"), ACE_Get_Opt::ARG_REQUIRED); get_opt.long_option(ACE_TEXT("domain-timeout"), ACE_Get_Opt::ARG_REQUIRED); get_opt.long_option(ACE_TEXT("domain-file"), ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option(ACE_TEXT("stop-application"), ACE_Get_Opt::NO_ARG); int c; ACE_CString s; @@ -327,6 +331,17 @@ parse_args(int argc, ACE_TCHAR *argv[], Options &options) break; } if ((ACE_OS::strcmp (get_opt.long_option (), + ACE_TEXT ("stop-application")) == 0)) + { + DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, + (LM_DEBUG, DLINFO + ACE_TEXT ("Plan_Launcher::parse_args - ") + ACE_TEXT ("Setting mode for destroyApplication: %C\n"), + get_opt.opt_arg ())); + options.mode_ = Options::STOPAPP; + break; + } + if ((ACE_OS::strcmp (get_opt.long_option (), ACE_TEXT ("domain-timeout")) == 0)) { DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, @@ -369,6 +384,17 @@ parse_args(int argc, ACE_TCHAR *argv[], Options &options) return false; } + if ((options.mode_ == Options::STOPAPP) + // Either way (EM/NM), we ca use a combination of a AM and a APP. + && !(options.am_ior_ && options.app_ior_)) + { + DANCE_ERROR (DANCE_LOG_EMERGENCY, + (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::parse_args - ") + ACE_TEXT ("Invalid set of plan identification ") + ACE_TEXT ("as required for stop application\n"))); + return false; + } + // tearing down plans requires a bit more complex set of options: if ((options.mode_ == Options::TEARDOWN) // Either way (EM/NM), we ca use a combination of a AM and a APP. @@ -546,6 +572,78 @@ launch_plan (const Options &opts, } int +stop_plan (const Options &opts, + DAnCE::Plan_Launcher_Base *pl_base, + const ::Deployment::DeploymentPlan *plan, + CORBA::ORB_ptr orb) +{ + CORBA::Object_var am; + CORBA::Object_var app; + + int rc = 0; + + if (opts.am_ior_ && opts.app_ior_) + { + DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, + (LM_DEBUG, DLINFO + ACE_TEXT ("Plan_Launcher::teardown_plan - ") + ACE_TEXT ("Tearing down plan with explicitly ") + ACE_TEXT ("nominated App and AM IORs.\n"))); + am = orb->string_to_object (opts.am_ior_); + app = orb->string_to_object (opts.app_ior_); + } + else + { + DANCE_ERROR (DANCE_LOG_EMERGENCY, + (LM_DEBUG, DLINFO + ACE_TEXT ("Plan_Launcher::stop_plan - ") + ACE_TEXT ("Stop plan curently requires an AM and App reference\n"))); + return -1; + } + + try + { + pl_base->teardown_application (am, app); + } + catch (const DAnCE::Deployment_Failure &ex) + { + if (!opts.quiet_) + { + DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO + ACE_TEXT ("Plan_Launcher::teardown_plan - ") + ACE_TEXT ("Application Teardown failed, exception: %C\n"), + ex.ex_.c_str ())); + } + rc = 1; + } + catch (const CORBA::Exception &ex) + { + if (!opts.quiet_) + { + DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO + ACE_TEXT ("Plan_Launcher::teardown_plan - ") + ACE_TEXT ("Application Teardown failed, ") + ACE_TEXT ("caught CORBA exception %C\n"), + ex._info ().c_str ())); + } + rc = 1; + } + catch (...) + { + if (!opts.quiet_) + { + DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO + ACE_TEXT ("Plan_Launcher::teardown_plan - ") + ACE_TEXT ("Application Teardown failed, ") + ACE_TEXT ("caught unknown C++ exception\n"))); + } + rc = 1; + } + + return rc; +} + +int teardown_plan (const Options &opts, DAnCE::Plan_Launcher_Base *pl_base, const ::Deployment::DeploymentPlan *plan, @@ -990,6 +1088,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) retval = teardown_plan (options, pl_base.get (), dp, orb.in ()); break; + case Options::STOPAPP: + retval = stop_plan (options, pl_base.get (), dp, orb.in ()); + break; + default: if (!options.quiet_) { diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp index 302910656f5..add10f5c1a9 100644 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp +++ b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp @@ -194,7 +194,7 @@ Plan_Launcher_Base_Impl< Manager, AppManager, Application> ACE_hrtime_t elapsed (0); timer_.elapsed_microseconds (elapsed); - outfile_ << "PreparePlan time: " << elapsed << '\n'; + outfile_ << "StartLaunch time: " << elapsed << '\n'; DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO @@ -350,10 +350,12 @@ Plan_Launcher_Base_Impl< Manager, AppManager, Application> application->finishLaunch (provided_connections, start); + + timer_.stop (); ACE_hrtime_t elapsed (0); timer_.elapsed_microseconds (elapsed); - outfile_ << "PreparePlan time: " << elapsed << '\n'; + outfile_ << "FinishLaunch time: " << elapsed << '\n'; DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO @@ -432,7 +434,18 @@ Plan_Launcher_Base_Impl< Manager, AppManager, Application> (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - ") ACE_TEXT("before invoking start on application...\n"))); + + timer_.reset (); + timer_.start (); + application->start (); + + timer_.stop (); + + ACE_hrtime_t elapsed (0); + timer_.elapsed_microseconds (elapsed); + outfile_ << "Start time: " << elapsed << '\n'; + DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - ") |