Changeset 7ca772 for src/Fragmentation


Ignore:
Timestamp:
Jun 22, 2012, 8:19:29 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:
246d97
Parents:
50f418
git-author:
Frederik Heber <heber@…> (12/12/11 08:32:27)
git-committer:
Frederik Heber <heber@…> (06/22/12 08:19:29)
Message:

Operations are now contained in CommandRegistry in FragmentController.

  • this is a tiny bit less nice due to required static_cast<>, however in the end we hopefully win due to possible placement inside a Queue.
  • FragmentController:getExitflag() can now just browse through all present Operations and return the first fail.
  • TESTFIX: changed regression tests Fragmentation/Automation a bit due to:
    • server-worker,addingjobs: addjobs now always adds two jobs.
    • JobAdder, ResultChecker, ResultGetter, and Shutdowner have been removed in favor of Controller and a specific command token.
Location:
src/Fragmentation/Automation
Files:
3 added
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/Controller/FragmentController.cpp

    r50f418 r7ca772  
    2929#include "Controller/FragmentController.hpp"
    3030#include "Controller/Commands/Operation.hpp"
     31#include "Controller/Commands/CheckResultsOperation.hpp"
     32#include "Controller/Commands/ReceiveJobsOperation.hpp"
     33#include "Controller/Commands/SendResultsOperation.hpp"
     34#include "Controller/Commands/ShutdownOperation.hpp"
    3135
    3236/** Constructor of class FragmentController.
     
    3842FragmentController::FragmentController(
    3943    boost::asio::io_service& io_service) :
    40     connection_(io_service),
    41     recjobs(connection_),
    42     checkres(connection_),
    43     sendres(connection_),
    44     shutdown(connection_)
     44    connection_(io_service)
    4545{
    4646  Info info(__FUNCTION__);
     47
     48  // insert commands into registry
     49  Commands.registerInstance(new CheckResultsOperation(connection_));
     50  Commands.registerInstance(new ReceiveJobsOperation(connection_));
     51  Commands.registerInstance(new SendResultsOperation(connection_));
     52  Commands.registerInstance(new ShutdownOperation(connection_));
    4753}
    4854
     
    5157 */
    5258FragmentController::~FragmentController()
    53 {}
     59{
     60  Commands.cleanup();
     61}
    5462
     63/** Getter for Exitflag of all any Operation.
     64 *
     65 * We simply go through all of them and check which failed.
     66 *
     67 * @return Combined Exitflag of all Operations in \a Commands.
     68 */
     69size_t FragmentController::getExitflag() const
     70{
     71  for (CommandRegistry::const_iterator iter = Commands.getBeginIter();
     72      iter != Commands.getEndIter(); ++iter)
     73    if ((iter->second)->getExitflag() != 0)
     74      return (iter->second)->getExitflag();
     75  return 0;
     76}
     77
  • src/Fragmentation/Automation/Controller/FragmentController.hpp

    r50f418 r7ca772  
    2222#include "FragmentResult.hpp"
    2323
    24 #include "Controller/Commands/Operation.hpp"
    25 #include "Controller/Commands/CheckResultsOperation.hpp"
    26 #include "Controller/Commands/ReceiveJobsOperation.hpp"
    27 #include "Controller/Commands/SendResultsOperation.hpp"
    28 #include "Controller/Commands/ShutdownOperation.hpp"
     24#include "Controller/CommandRegistry.hpp"
    2925
    3026/** The FragmentController sends bunches of jobs to a FragmentScheduler,
     
    4339  ~FragmentController();
    4440
     41  /// getter for operations exit flag.
     42  size_t getExitflag() const;
     43
    4544protected:
    4645  /// The Connection to the server.
     
    4847
    4948public:
    50 
    51   ReceiveJobsOperation recjobs;
    52   CheckResultsOperation checkres;
    53   SendResultsOperation  sendres;
    54   ShutdownOperation shutdown;
    55 
    56   // get the exit flag of the last operations
    57   size_t getExitflag() const
    58   {
    59     if (recjobs.getExitflag() != 0)
    60       return recjobs.getExitflag();
    61     if (checkres.getExitflag() != 0)
    62       return checkres.getExitflag();
    63     if (sendres.getExitflag() != 0)
    64       return sendres.getExitflag();
    65     if (shutdown.getExitflag() != 0)
    66       return shutdown.getExitflag();
    67     return 0;
    68   }
    69 
     49  /// Registry with all commands of this controller
     50  CommandRegistry Commands;
    7051};
    7152
  • src/Fragmentation/Automation/Makefile.am

    r50f418 r7ca772  
    3131FRAGMENTATIONAUTOMATIONSOURCE = \
    3232  atexit.cpp \
     33  Controller/CommandRegistry.cpp \
    3334  Controller/FragmentController.cpp \
    3435  Controller/Commands/CheckResultsOperation.cpp \
     
    4243  Connection.hpp \
    4344  ControllerChoices.hpp \
     45  Controller/CommandRegistry.hpp \
    4446  Controller/FragmentController.hpp \
    4547  Controller/Commands/CheckResultsOperation.hpp \
     
    5961AM_CPPFLAGS = ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS}
    6062
    61 bin_PROGRAMS += JobAdder ResultChecker ResultGetter Server Shutdowner Worker
     63bin_PROGRAMS += Controller Server Worker
    6264
    6365CONTROLLERSOURCE =
     
    8284  FragmentWorker.hpp
    8385
    84 JobAdder_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/JobAdder.cpp
    85 JobAdder_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
    86 JobAdder_CXXFLAGS = $(AM_CPPFLAGS)
    87 JobAdder_LDADD = \
    88   libMolecuilderFragmentationAutomation.la \
    89   libMolecuilderFragmentJobs.la \
    90   $(BOOST_ASIO_LIBS) \
    91   $(BOOST_SERIALIZATION_LIBS) \
    92   $(BOOST_THREAD_LIBS) \
    93   $(BOOST_SYSTEM_LIBS) \
    94   ${CodePatterns_LIBS}
    95 
    96 ResultChecker_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/ResultChecker.cpp
    97 ResultChecker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
    98 ResultChecker_CXXFLAGS = $(AM_CPPFLAGS)
    99 ResultChecker_LDADD = \
    100   libMolecuilderFragmentationAutomation.la \
    101   libMolecuilderFragmentJobs.la \
    102   $(BOOST_ASIO_LIBS) \
    103   $(BOOST_SERIALIZATION_LIBS) \
    104   $(BOOST_THREAD_LIBS) \
    105   $(BOOST_SYSTEM_LIBS) \
    106   ${CodePatterns_LIBS}
    107 
    108 ResultGetter_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/ResultGetter.cpp
    109 ResultGetter_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
    110 ResultGetter_CXXFLAGS = $(AM_CPPFLAGS)
    111 ResultGetter_LDADD = \
     86Controller_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) controller.cpp
     87Controller_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
     88Controller_CXXFLAGS = $(AM_CPPFLAGS)
     89Controller_LDADD = \
    11290  libMolecuilderFragmentationAutomation.la \
    11391  libMolecuilderFragmentJobs.la \
     
    130108  ${CodePatterns_LIBS}
    131109
    132 Shutdowner_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/Shutdowner.cpp
    133 Shutdowner_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
    134 Shutdowner_CXXFLAGS = $(AM_CPPFLAGS)
    135 Shutdowner_LDADD = \
    136   libMolecuilderFragmentationAutomation.la \
    137   libMolecuilderFragmentJobs.la \
    138   $(BOOST_ASIO_LIBS) \
    139   $(BOOST_SERIALIZATION_LIBS) \
    140   $(BOOST_THREAD_LIBS) \
    141   $(BOOST_SYSTEM_LIBS) \
    142   ${CodePatterns_LIBS}
    143 
    144110Worker_SOURCES = $(WORKERSOURCE) $(WORKERHEADER)
    145111Worker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
Note: See TracChangeset for help on using the changeset viewer.