Changeset 6f2bc7 for src


Ignore:
Timestamp:
Jun 27, 2012, 4:07:20 PM (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:
d1dbfc
Parents:
bf56f6
git-author:
Frederik Heber <heber@…> (02/16/12 11:12:40)
git-committer:
Frederik Heber <heber@…> (06/27/12 16:07:20)
Message:

CheckResultsOperation now receives both scheduled and done jobs.

Location:
src/Fragmentation/Automation
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/Controller/Commands/CheckResultsOperation.cpp

    rbf56f6 r6f2bc7  
    2626#include <iostream>
    2727#include "Connection.hpp" // Must come before boost/serialization headers.
     28#include <boost/serialization/vector.hpp>
    2829#include "CodePatterns/Info.hpp"
    2930#include "CodePatterns/Log.hpp"
     
    4647    enum ControllerChoices choice = CheckState;
    4748    connection_.async_write(choice,
    48       boost::bind(&CheckResultsOperation::handle_ReceiveDoneJobs, this,
     49      boost::bind(&CheckResultsOperation::handle_ReceiveJobInfo, this,
    4950      boost::asio::placeholders::error));
    5051  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
     
    6869 * \param e error code if something went wrong
    6970 */
    70 void CheckResultsOperation::handle_ReceiveDoneJobs(const boost::system::error_code& e)
     71void CheckResultsOperation::handle_ReceiveJobInfo(const boost::system::error_code& e)
    7172{
    7273  Info info(__FUNCTION__);
     
    7576    // The connection::async_read() function will automatically
    7677    // decode the data that is written to the underlying socket.
    77     LOG(1, "INFO: Checking number of done jobs ...");
    78     connection_.async_read(doneJobs,
     78    LOG(1, "INFO: Obtaining number of present and done jobs ...");
     79    connection_.async_read(jobInfo,
    7980      boost::bind(&Operation::handle_FinishOperation, this,
    8081      boost::asio::placeholders::error));
     
    8889}
    8990
     91/** Getter for jobInfo.
     92 *
     93 * \sa checkResults()
     94 * \param number of present jobs
     95 */
     96size_t CheckResultsOperation::getPresentJobs() const
     97{
     98  ASSERT( jobInfo.size() == (size_t)2,
     99      "CheckResultsOperation::getPresentJobs() - jobInfo does not contain present and done jobs.");
     100  return jobInfo[0];
     101}
     102
     103/** Getter for jobInfo.
     104 *
     105 * \sa checkResults()
     106 * \param number of done jobs
     107 */
     108size_t CheckResultsOperation::getDoneJobs() const
     109{
     110  ASSERT( jobInfo.size() == (size_t)2,
     111      "CheckResultsOperation::getPresentJobs() - jobInfo does not contain present and done jobs.");
     112  return jobInfo[1];
     113}
     114
  • src/Fragmentation/Automation/Controller/Commands/CheckResultsOperation.hpp

    rbf56f6 r6f2bc7  
    2121#include "Controller/Commands/Operation.hpp"
    2222
    23 
     23/** This Operations requests number of present jobs and present results (done
     24 * jobs) from the server.
     25 *
     26 */
    2427class CheckResultsOperation : public Operation  {
    2528public:
     
    2730  CheckResultsOperation(Connection &_connection) :
    2831    Operation(std::string("checkresults"), _connection),
    29     doneJobs(0)
     32    jobInfo((size_t)2, 0)
    3033        {}
    3134  /// Destructor for class CheckResultsOperation
     
    3841
    3942  /// Callback function when doneJobs have been received.
    40   void handle_ReceiveDoneJobs(const boost::system::error_code& e);
     43  void handle_ReceiveJobInfo(const boost::system::error_code& e);
    4144
    42   /** Getter for doneJobs.
    43    *
    44    * \sa checkResults()
    45    * \param doneJobs
    46    */
    47   size_t getDoneJobs() const
    48   {
    49     return doneJobs;
    50   }
     45  /// Getter for presentJobs
     46  size_t getPresentJobs() const;
     47
     48  /// Getter for doneJobs
     49  size_t getDoneJobs() const;
    5150
    5251protected:
    53   /// currently calculated results
    54   size_t doneJobs;
     52  /// current jobs left to calculate and currently calculated results
     53  std::vector<size_t> jobInfo;
    5554};
    5655
  • src/Fragmentation/Automation/FragmentScheduler.cpp

    rbf56f6 r6f2bc7  
    6666  ),
    6767  result( new FragmentResult(JobId::NoJob) ),
     68  jobInfo((size_t)2, 0),
    6869  choice(NoOperation),
    6970  Exitflag(OkFlag)
     
    259260    {
    260261      // first update number
    261       doneJobs = JobsQueue.getDoneJobs();
     262      jobInfo[0] = JobsQueue.getPresentJobs();
     263      jobInfo[1] = JobsQueue.getDoneJobs();
    262264      // now we accept connections to check for state of calculations
    263       LOG(1, "INFO: Sending state that "+toString(doneJobs)+" jobs are done to controller ...");
    264       conn->async_write(doneJobs,
     265      LOG(1, "INFO: Sending state that "+toString(jobInfo[0])+" jobs are present and "+toString(jobInfo[1])+" jobs are done to controller ...");
     266      conn->async_write(jobInfo,
    265267        boost::bind(&FragmentScheduler::handle_CheckResultState, this,
    266268        boost::asio::placeholders::error, conn));
     
    345347  Info info(__FUNCTION__);
    346348  // do nothing
    347   LOG(1, "INFO: Sent that " << doneJobs << " jobs are done.");
     349  LOG(1, "INFO: Sent that " << jobInfo << " jobs are (scheduled, done).");
    348350}
    349351
  • src/Fragmentation/Automation/FragmentScheduler.hpp

    rbf56f6 r6f2bc7  
    9797  std::vector<FragmentJob::ptr> jobs;
    9898
    99   /// number of jobs that are calculated, required for returning status
    100   size_t doneJobs;
     99  /// number of jobs that are waiting to be and are calculated, required for returning status
     100  std::vector<size_t> jobInfo;
    101101
    102102  // choice
  • src/Fragmentation/Automation/controller.cpp

    rbf56f6 r6f2bc7  
    106106      controller.Commands.getByName("checkresults"));
    107107  const size_t doneJobs = checkres->getDoneJobs();
    108   LOG(1, "INFO: " << doneJobs << " jobs are calculated so far.");
     108  const size_t presentJobs = checkres->getPresentJobs();
     109  LOG(1, "INFO: #" << presentJobs << " are waiting in the queue and #" << doneJobs << " jobs are calculated so far.");
    109110}
    110111
Note: See TracChangeset for help on using the changeset viewer.