Changeset 9d14c3
- Timestamp:
- Jul 2, 2012, 7:54:12 AM (12 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:
- 50d095
- Parents:
- 425fc6
- git-author:
- Frederik Heber <heber@…> (03/04/12 20:26:06)
- git-committer:
- Frederik Heber <heber@…> (07/02/12 07:54:12)
- Location:
- src/Fragmentation/Automation
- Files:
-
- 5 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Automation/Controller/Commands/ReceiveResultsOperation.cpp
r425fc6 r9d14c3 7 7 8 8 /* 9 * SendResultsOperation.cpp9 * ReceiveResultsOperation.cpp 10 10 * 11 11 * Created on: Dec 11, 2011 … … 33 33 #include "Results/FragmentResult.hpp" 34 34 35 #include "Controller/Commands/ SendResultsOperation.hpp"35 #include "Controller/Commands/ReceiveResultsOperation.hpp" 36 36 37 37 /** Handle connect operation to send results. … … 40 40 * \param endpoint_iterator endpoint of the connection 41 41 */ 42 void SendResultsOperation::handle_connect(const boost::system::error_code& e,42 void ReceiveResultsOperation::handle_connect(const boost::system::error_code& e, 43 43 boost::asio::ip::tcp::resolver::iterator endpoint_iterator) 44 44 { … … 47 47 { 48 48 // Successfully established connection. Give choice. 49 enum ControllerChoices choice = SendResults;49 enum ControllerChoices choice = ReceiveResults; 50 50 connection_.async_write(choice, 51 boost::bind(& SendResultsOperation::handle_ReceivingResults, this,51 boost::bind(&ReceiveResultsOperation::handle_ReceivingResults, this, 52 52 boost::asio::placeholders::error)); 53 53 } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) { … … 56 56 boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator; 57 57 connection_.socket().async_connect(endpoint, 58 boost::bind(& SendResultsOperation::handle_connect, this,58 boost::bind(&ReceiveResultsOperation::handle_connect, this, 59 59 boost::asio::placeholders::error, ++endpoint_iterator)); 60 60 } else { … … 67 67 } 68 68 69 /** Callback function when results have been received.69 /** Callback function when preparing to receive results 70 70 * 71 71 * \param e error code if something went wrong 72 72 */ 73 void SendResultsOperation::handle_ReceivingResults(const boost::system::error_code& e)73 void ReceiveResultsOperation::handle_ReceivingResults(const boost::system::error_code& e) 74 74 { 75 75 Info info(__FUNCTION__); 76 76 if (!e) 77 77 { 78 79 80 81 82 boost::bind(&SendResultsOperation::handle_ReceivedResults, this,83 78 // The connection::async_read() function will automatically 79 // decode the data that is written to the underlying socket. 80 LOG(1, "INFO: Sending "+toString(results.size())+" results ..."); 81 connection_.async_read(results, 82 boost::bind(&ReceiveResultsOperation::handle_ReceivedResults, this, 83 boost::asio::placeholders::error)); 84 84 } 85 85 else … … 89 89 ELOG(1, e.message()); 90 90 } 91 92 // Since we are not starting a new operation the io_service will run out of93 // work to do and the client will exit.94 91 } 95 96 92 97 93 /** Callback function when results have been received. … … 99 95 * \param e error code if something went wrong 100 96 */ 101 void SendResultsOperation::handle_ReceivedResults(const boost::system::error_code& e)97 void ReceiveResultsOperation::handle_ReceivedResults(const boost::system::error_code& e) 102 98 { 103 99 Info info(__FUNCTION__); … … 105 101 LOG(1, "INFO: Received "+toString(results.size())+" results."); 106 102 107 AsyncOperation::handle_FinishOperation(e);103 ReceiveResultsOperation::handle_FinishOperation(e); 108 104 } 109 105 … … 113 109 * \return vector of results for the added jobs (\sa addJobs()). 114 110 */ 115 std::vector<FragmentResult::ptr> SendResultsOperation::getResults()111 std::vector<FragmentResult::ptr> ReceiveResultsOperation::getResults() 116 112 { 117 113 Info info(__FUNCTION__); -
src/Fragmentation/Automation/Controller/Commands/ReceiveResultsOperation.hpp
r425fc6 r9d14c3 1 1 /* 2 * SendResultsOperation.hpp2 * ReceiveResultsOperation.hpp 3 3 * 4 4 * Created on: Dec 11, 2011 … … 6 6 */ 7 7 8 #ifndef FRAGMENTCONTROLLER_ SENDRESULTSOPERATION_HPP_9 #define FRAGMENTCONTROLLER_ SENDRESULTSOPERATION_HPP_8 #ifndef FRAGMENTCONTROLLER_RECEIVERESULTSOPERATION_HPP_ 9 #define FRAGMENTCONTROLLER_RECEIVERESULTSOPERATION_HPP_ 10 10 11 11 // include config.h … … 23 23 #include "Controller/Commands/AsyncOperation.hpp" 24 24 25 class SendResultsOperation : public AsyncOperation {25 class ReceiveResultsOperation : public AsyncOperation { 26 26 public: 27 /// Constructor for class SendResultsOperation.28 SendResultsOperation(Connection &_connection) :29 AsyncOperation(std::string(" sendresults"), _connection) {}30 /// Destructor for class SendResultsOperation31 ~ SendResultsOperation() {}27 /// Constructor for class ReceiveResultsOperation. 28 ReceiveResultsOperation(Connection &_connection) : 29 AsyncOperation(std::string("receiveresults"), _connection) {} 30 /// Destructor for class ReceiveResultsOperation 31 ~ReceiveResultsOperation() {} 32 32 33 33 public: … … 50 50 }; 51 51 52 #endif /* FRAGMENTCONTROLLER_ SENDRESULTSOPERATION_HPP_ */52 #endif /* FRAGMENTCONTROLLER_RECEIVERESULTSOPERATION_HPP_ */ -
src/Fragmentation/Automation/Controller/FragmentController.cpp
r425fc6 r9d14c3 30 30 #include "Controller/Commands/CheckResultsOperation.hpp" 31 31 #include "Controller/Commands/GetNextJobIdOperation.hpp" 32 #include "Controller/Commands/ReceiveResultsOperation.hpp" 32 33 #include "Controller/Commands/SendJobsOperation.hpp" 33 #include "Controller/Commands/SendResultsOperation.hpp"34 34 #include "Controller/Commands/ShutdownOperation.hpp" 35 35 … … 49 49 Commands.registerInstance(new CheckResultsOperation(connection_)); 50 50 Commands.registerInstance(new GetNextJobIdOperation(connection_)); 51 Commands.registerInstance(new ReceiveResultsOperation(connection_)); 51 52 Commands.registerInstance(new SendJobsOperation(connection_)); 52 Commands.registerInstance(new SendResultsOperation(connection_));53 53 Commands.registerInstance(new ShutdownOperation(connection_)); 54 54 } -
src/Fragmentation/Automation/ControllerChoices.hpp
r425fc6 r9d14c3 20 20 SendJobs, 21 21 CheckState, 22 SendResults,22 ReceiveResults, 23 23 ShutdownControllerSocket 24 24 }; -
src/Fragmentation/Automation/FragmentScheduler.cpp
r425fc6 r9d14c3 374 374 break; 375 375 } 376 case SendResults:376 case ReceiveResults: 377 377 { 378 378 const std::vector<FragmentResult::ptr> results = JobsQueue.getAllResults(); -
src/Fragmentation/Automation/Makefile.am
r425fc6 r9d14c3 48 48 Controller/Commands/GetNextJobIdOperation.cpp \ 49 49 Controller/Commands/ObtainJobOperation.cpp \ 50 Controller/Commands/ReceiveResultsOperation.cpp \ 50 51 Controller/Commands/RemoveFromPoolOperation.cpp \ 51 52 Controller/Commands/SendJobsOperation.cpp \ 52 53 Controller/Commands/SendJobToWorkerOperation.cpp \ 53 Controller/Commands/SendResultsOperation.cpp \54 54 Controller/Commands/ShutdownOperation.cpp \ 55 55 Controller/Commands/ShutdownWorkerOperation.cpp \ … … 65 65 Controller/Commands/ObtainJobOperation.hpp \ 66 66 Controller/Commands/Operation.hpp \ 67 Controller/Commands/ReceiveResultsOperation.hpp \ 67 68 Controller/Commands/RemoveFromPoolOperation.hpp \ 68 69 Controller/Commands/SendJobsOperation.hpp \ 69 70 Controller/Commands/SendJobToWorkerOperation.hpp \ 70 Controller/Commands/SendResultsOperation.hpp \71 71 Controller/Commands/ShutdownOperation.hpp \ 72 72 Controller/Commands/ShutdownWorkerOperation.hpp \ -
src/Fragmentation/Automation/controller.cpp
r425fc6 r9d14c3 42 42 #include "Controller/Commands/CheckResultsOperation.hpp" 43 43 #include "Controller/Commands/GetNextJobIdOperation.hpp" 44 #include "Controller/Commands/ReceiveResultsOperation.hpp" 44 45 #include "Controller/Commands/SendJobsOperation.hpp" 45 #include "Controller/Commands/SendResultsOperation.hpp"46 46 #include "Controller/Commands/ShutdownOperation.hpp" 47 47 #include "Jobs/MPQCCommandJob.hpp" … … 197 197 const std::string &service) 198 198 { 199 SendResultsOperation *sendres = static_cast<SendResultsOperation *>(200 controller.Commands.getByName(" sendresults"));201 (* sendres)(host, service);199 ReceiveResultsOperation *receiveres = static_cast<ReceiveResultsOperation *>( 200 controller.Commands.getByName("receiveresults")); 201 (*receiveres)(host, service); 202 202 } 203 203 … … 208 208 void printreceivedresults(FragmentController &controller) 209 209 { 210 SendResultsOperation *sendres = static_cast<SendResultsOperation *>(211 controller.Commands.getByName(" sendresults"));212 std::vector<FragmentResult::ptr> results = sendres->getResults();210 ReceiveResultsOperation *receiveres = static_cast<ReceiveResultsOperation *>( 211 controller.Commands.getByName("receiveresults")); 212 std::vector<FragmentResult::ptr> results = receiveres->getResults(); 213 213 for (std::vector<FragmentResult::ptr>::const_iterator iter = results.begin(); 214 214 iter != results.end(); ++iter) … … 222 222 void printreceivedmpqcresults(FragmentController &controller, const std::string &KeySetFilename) 223 223 { 224 SendResultsOperation *sendres = static_cast<SendResultsOperation *>(225 controller.Commands.getByName(" sendresults"));226 std::vector<FragmentResult::ptr> results = sendres->getResults();224 ReceiveResultsOperation *receiveres = static_cast<ReceiveResultsOperation *>( 225 controller.Commands.getByName("receiveresults")); 226 std::vector<FragmentResult::ptr> results = receiveres->getResults(); 227 227 228 228 // parse in KeySetfile
Note:
See TracChangeset
for help on using the changeset viewer.