Changeset 668b55


Ignore:
Timestamp:
Jul 2, 2012, 8:32:00 AM (13 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
270364
Parents:
b15c4f
git-author:
Frederik Heber <heber@…> (05/03/12 14:20:05)
git-committer:
Frederik Heber <heber@…> (07/02/12 08:32:00)
Message:

FragmentScheduler::shutdown() now returns bool and does not remove workers anymore.

Location:
src/Fragmentation/Automation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/FragmentScheduler.cpp

    rb15c4f r668b55  
    395395      // only allow for shutdown when there are no more jobs in the queue
    396396      if (!JobsQueue.isJobPresent()) {
    397         LaunchNewAcceptor = false;
     397        // we shutdown? Hence, also shutdown controller
     398        LaunchNewAcceptor = !shutdownAllSockets();
    398399      } else {
    399400        ELOG(2, "There are still jobs waiting in the queue.");
     
    413414      // Start an accept operation for a new Connection.
    414415      initiateSocket();
    415     } else {
    416       // we shutdown? Hence, also shutdown controller
    417       shutdownAllSockets();
    418416    }
    419417  }
     
    572570 * calculating which is probably better).
    573571 *
    574  */
    575 void FragmentScheduler::shutdown()
    576 {
    577   LOG(1, "INFO: Shutting all down ...");
    578 
    579   /// Remove all workers
    580   removeAllWorkers();
    581 
    582   /// close the worker listener's socket
    583   WorkerListener.closeSocket();
    584 
    585   /// close the controller listener's socket
    586   ControllerListener.closeSocket();
    587 
    588   /// finally, stop the io_service
    589   io_service.stop();
     572 * \note We only shutdown when there are no workers left
     573 *
     574 * @return true - doing shutdown, false - precondition not met, not shutting down
     575 */
     576bool FragmentScheduler::shutdown()
     577{
     578  if (!pool.presentIdleWorkers() && !pool.hasBusyWorkers()) {
     579    LOG(1, "INFO: Shutting all down ...");
     580
     581    /// close the worker listener's socket
     582    WorkerListener.closeSocket();
     583
     584    /// close the controller listener's socket
     585    ControllerListener.closeSocket();
     586
     587    /// finally, stop the io_service
     588    io_service.stop();
     589    return true;
     590  } else {
     591    ELOG(2, "There are still idle or busy workers present.");
     592    return false;
     593  }
    590594}
    591595
  • src/Fragmentation/Automation/FragmentScheduler.hpp

    rb15c4f r668b55  
    5252  void sendJobToWorker(const WorkerAddress &address, FragmentJob::ptr &job);
    5353  void sendAvailableJobToNextIdleWorker();
    54   void shutdown();
     54  bool shutdown();
    5555  void shutdownWorker(const WorkerAddress &address);
    5656  void removeAllWorkers();
     
    127127        FragmentQueue &_JobsQueue,
    128128        boost::function<void ()> _removeallWorkers,
    129         boost::function<void ()> _shutdownAllSockets) :
     129        boost::function<bool ()> _shutdownAllSockets) :
    130130      Listener(io_service, port),
    131131      JobsQueue(_JobsQueue),
     
    180180
    181181    //!> bound function to shutdown all sockets
    182     boost::function<void ()> shutdownAllSockets;
     182    boost::function<bool ()> shutdownAllSockets;
    183183
    184184    // TODO: replace this instance by a IdPool.
Note: See TracChangeset for help on using the changeset viewer.