Changeset d57585
- Timestamp:
- Jul 2, 2012, 8:32:08 AM (13 years ago)
- 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:
- bff93d
- Parents:
- 9db22d
- git-author:
- Frederik Heber <heber@…> (05/11/12 19:42:43)
- git-committer:
- Frederik Heber <heber@…> (07/02/12 08:32:08)
- Location:
- src/Fragmentation/Automation
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Automation/FragmentController.cpp
r9db22d rd57585 47 47 FragmentController::FragmentController( 48 48 boost::asio::io_service& io_service) : 49 connection_(io_service) 49 connection_(io_service), 50 failed(boost::bind(&ExitflagContainer::setExitflag, this, ExitflagContainer::ErrorFlag)) 50 51 { 51 52 Info info(__FUNCTION__); 52 53 53 54 // insert commands into registry 54 Commands.registerInstance(new CheckResultsOperation(connection_, AsyncOperation::NoOpCallback ));55 Commands.registerInstance(new GetNextJobIdOperation(connection_, AsyncOperation::NoOpCallback ));56 Commands.registerInstance(new ReceiveResultsOperation(connection_, AsyncOperation::NoOpCallback ));55 Commands.registerInstance(new CheckResultsOperation(connection_, AsyncOperation::NoOpCallback, failed)); 56 Commands.registerInstance(new GetNextJobIdOperation(connection_, AsyncOperation::NoOpCallback, failed)); 57 Commands.registerInstance(new ReceiveResultsOperation(connection_, AsyncOperation::NoOpCallback, failed)); 57 58 Commands.registerInstance(new RemoveAllWorkerOperation(connection_)); 58 Commands.registerInstance(new SendJobsOperation(connection_, AsyncOperation::NoOpCallback ));59 Commands.registerInstance(new SendJobsOperation(connection_, AsyncOperation::NoOpCallback, failed)); 59 60 Commands.registerInstance(new ShutdownOperation(connection_)); 60 61 } … … 67 68 Commands.cleanup(); 68 69 } 69 70 /** Getter for Exitflag of all any Operation.71 *72 * We simply go through all of them and check which failed.73 *74 * @return Combined Exitflag of all Operations in \a Commands.75 */76 size_t FragmentController::getExitflag() const77 {78 for (OperationRegistry::const_iterator iter = Commands.getBeginIter();79 iter != Commands.getEndIter(); ++iter)80 if ((iter->second)->getExitflag() != 0)81 return (iter->second)->getExitflag();82 return 0;83 }84 85 70 86 71 /** Requests an available id from server -
src/Fragmentation/Automation/FragmentController.hpp
r9db22d rd57585 19 19 20 20 #include "Connection.hpp" 21 #include "ExitflagContainer.hpp" 21 22 #include "JobId.hpp" 22 23 #include "Jobs/FragmentJob.hpp" … … 34 35 * of the fragments on distant computers. 35 36 */ 36 class FragmentController 37 class FragmentController : public ExitflagContainer 37 38 { 38 39 public: 39 40 FragmentController(boost::asio::io_service& io_service); 40 41 ~FragmentController(); 41 42 /// getter for operations exit flag.43 size_t getExitflag() const;44 42 45 43 void requestIds(const std::string &host, const std::string &service, const size_t NumberIds); … … 61 59 //!> registry with all operations of this controller 62 60 OperationRegistry Commands; 61 62 private: 63 //!> internally bound function that sets the Exitflag to ErrorFlag 64 boost::function<void ()> failed; 63 65 }; 64 66 -
src/Fragmentation/Automation/Makefile.am
r9db22d rd57585 93 93 FRAGMENTATIONAUTOMATIONHELPERHEADER = \ 94 94 atexit.hpp \ 95 ExitflagContainer.hpp \ 95 96 GlobalJobId.hpp \ 96 97 Listener.hpp \ -
src/Fragmentation/Automation/Operations/AsyncOperation.cpp
r9db22d rd57585 53 53 { 54 54 // An error occurred. 55 Exitflag = ErrorFlag;56 55 ELOG(1, e.message()); 57 56 callback_on_failure(); -
src/Fragmentation/Automation/Operations/Controllers/CheckResultsOperation.cpp
r9db22d rd57585 60 60 // operation the io_service will run out of work to do and the client will 61 61 // exit. 62 Exitflag = ErrorFlag;63 62 ELOG(1, e.message()); 63 AsyncOperation::handle_FinishOperation(e); 64 64 } 65 65 } … … 84 84 { 85 85 // An error occurred. 86 Exitflag = ErrorFlag;87 86 ELOG(1, e.message()); 87 AsyncOperation::handle_FinishOperation(e); 88 88 } 89 89 } -
src/Fragmentation/Automation/Operations/Controllers/GetNextJobIdOperation.cpp
r9db22d rd57585 62 62 // exit. 63 63 ELOG(1, e.message()); 64 AsyncOperation::handle_FinishOperation(e); 64 65 } 65 66 } … … 85 86 // An error occurred. 86 87 ELOG(1, e.message()); 88 AsyncOperation::handle_FinishOperation(e); 87 89 } 88 90 } … … 108 110 // An error occurred. 109 111 ELOG(1, e.message()); 112 AsyncOperation::handle_FinishOperation(e); 110 113 } 111 114 } -
src/Fragmentation/Automation/Operations/Controllers/ReceiveResultsOperation.cpp
r9db22d rd57585 62 62 // operation the io_service will run out of work to do and the client will 63 63 // exit. 64 Exitflag = ErrorFlag;65 64 ELOG(1, e.message()); 65 AsyncOperation::handle_FinishOperation(e); 66 66 } 67 67 } … … 86 86 { 87 87 // An error occurred. 88 Exitflag = ErrorFlag;89 88 ELOG(1, e.message()); 89 AsyncOperation::handle_FinishOperation(e); 90 90 } 91 91 } -
src/Fragmentation/Automation/Operations/Controllers/SendJobsOperation.cpp
r9db22d rd57585 63 63 // operation the io_service will run out of work to do and the client will 64 64 // exit. 65 Exitflag = ErrorFlag;66 65 ELOG(1, e.message()); 66 AsyncOperation::handle_FinishOperation(e); 67 67 } 68 68 } … … 88 88 { 89 89 // An error occurred. 90 Exitflag = ErrorFlag;91 90 ELOG(1, e.message()); 91 AsyncOperation::handle_FinishOperation(e); 92 92 } 93 93 -
src/Fragmentation/Automation/Operations/Operation.hpp
r9db22d rd57585 34 34 Operation(const std::string &_name, Connection &_connection) : 35 35 connection_(_connection), 36 Exitflag(OkFlag),37 36 name(_name) 38 37 {} … … 49 48 virtual void operator()(const std::string& _host, const std::string& _service) = 0; 50 49 51 enum Exitflag_t { 52 OkFlag = 0, 53 ErrorFlag = 255 54 }; 55 56 /** Getter for Exitflag. 57 * 58 * @return Exitflag 59 */ 60 size_t getExitflag() const 61 { 62 return Exitflag; 63 } 64 65 /** Getter for name. 50 /** Getter for name. 66 51 * 67 52 * @return const reference to Operation::name. … … 75 60 Connection &connection_; 76 61 77 // exit flag of this operation, derived classes may change it78 enum Exitflag_t Exitflag;79 80 62 private: 81 63 /// Name of this AsyncOperation (required for Registry pattern) -
src/Fragmentation/Automation/Operations/Servers/SendJobToWorkerOperation.cpp
r9db22d rd57585 59 59 // operation the io_service will run out of work to do and the client will 60 60 // exit. 61 Exitflag = ErrorFlag;62 61 ELOG(1, e.message()); 62 AsyncOperation::handle_FinishOperation(e); 63 63 } 64 64 } -
src/Fragmentation/Automation/Operations/Servers/ShutdownWorkerOperation.cpp
r9db22d rd57585 62 62 // operation the io_service will run out of work to do and the client will 63 63 // exit. 64 Exitflag = ErrorFlag;65 64 ELOG(1, e.message()); 65 AsyncOperation::handle_FinishOperation(e); 66 66 } 67 67 } -
src/Fragmentation/Automation/Operations/Workers/EnrollInPoolOperation.cpp
r9db22d rd57585 57 57 // exit. 58 58 ELOG(1, e.message()); 59 AsyncOperation::handle_FinishOperation(e); 59 60 } 60 61 } … … 80 81 // exit. 81 82 ELOG(1, e.message()); 83 AsyncOperation::handle_FinishOperation(e); 82 84 } 83 85 } … … 101 103 // exit. 102 104 ELOG(1, e.message()); 105 AsyncOperation::handle_FinishOperation(e); 103 106 } 104 107 } -
src/Fragmentation/Automation/Operations/Workers/ObtainJobOperation.cpp
r9db22d rd57585 57 57 // exit. 58 58 ELOG(1, e.message()); 59 AsyncOperation::handle_FinishOperation(e); 59 60 } 60 61 } -
src/Fragmentation/Automation/Operations/Workers/SubmitResultOperation.cpp
r9db22d rd57585 57 57 // operation the io_service will run out of work to do and the client will 58 58 // exit. 59 exitflag = ErrorFlag;60 59 ELOG(1, e.message()); 60 AsyncOperation::handle_FinishOperation(e); 61 61 } 62 62 } … … 79 79 // operation the io_service will run out of work to do and the client will 80 80 // exit. 81 exitflag = ErrorFlag;82 81 ELOG(1, e.message()); 82 AsyncOperation::handle_FinishOperation(e); 83 83 } 84 84 } … … 101 101 // operation the io_service will run out of work to do and the client will 102 102 // exit. 103 exitflag = ErrorFlag;104 103 ELOG(1, e.message()); 104 AsyncOperation::handle_FinishOperation(e); 105 105 } 106 106 } -
src/Fragmentation/Automation/Operations/Workers/SubmitResultOperation.hpp
r9db22d rd57585 34 34 AsyncOperation(std::string("submitresult"),_connection, _callback_on_success, _callback_on_failure), 35 35 result( new FragmentResult(JobId::NoJob, std::string("EmptyResult")) ), 36 address(_address), 37 exitflag(OkFlag) 36 address(_address) 38 37 {} 39 38 /// Destructor for class SubmitResultOperation … … 48 47 result.reset(); 49 48 result = _result; 50 }51 52 public:53 enum {54 OkFlag = 0,55 ErrorFlag = 156 };57 58 /** Returns the flag of the handled operation.59 *60 */61 size_t getFlag() const62 {63 return exitflag;64 49 } 65 50 … … 84 69 //!> address for listener 85 70 WorkerAddress address; 86 87 /// exit flag88 size_t exitflag;89 71 }; 90 72 -
src/Fragmentation/Automation/Pool/PoolWorker.cpp
r9db22d rd57585 68 68 address(listenhost, listenservice), 69 69 connection_(_io_service), 70 enrollOp(connection_, address, AsyncOperation::NoOpCallback, AsyncOperation::NoOpCallback), 71 submitOp(connection_, address, AsyncOperation::NoOpCallback, AsyncOperation::NoOpCallback), 70 failed(boost::bind(&ExitflagContainer::setExitflag, this, ExitflagContainer::ErrorFlag)), 71 enrollOp(connection_, address, AsyncOperation::NoOpCallback, failed), 72 submitOp(connection_, address, AsyncOperation::NoOpCallback, failed), 72 73 submitresult(boost::bind(&AsyncOperation::operator(), 73 74 boost::ref(submitOp), -
src/Fragmentation/Automation/Pool/PoolWorker.hpp
r9db22d rd57585 21 21 #include <vector> 22 22 #include "Connection.hpp" 23 #include "ExitflagContainer.hpp" 23 24 #include "Jobs/FragmentJob.hpp" 24 25 #include "Operations/Workers/EnrollInPoolOperation.hpp" … … 31 32 * 32 33 */ 33 class PoolWorker 34 class PoolWorker : public ExitflagContainer 34 35 { 35 36 public: … … 47 48 size_t getFlag() const 48 49 { 49 return submitOp.getFlag() + PoolListener.getExitflag(); 50 if (PoolListener.getExitflag()) 51 return PoolListener.getExitflag(); 52 if (getExitflag()) 53 return getExitflag(); 54 return 0; 50 55 } 51 56 … … 95 100 Connection connection_; 96 101 102 //!> internally bound function that sets the Exitflag to ErrorFlag 103 boost::function<void ()> failed; 104 97 105 //!> operation that handles obtaining a job 98 106 EnrollInPoolOperation enrollOp;
Note:
See TracChangeset
for help on using the changeset viewer.