Changeset a61dbb


Ignore:
Timestamp:
Jul 14, 2014, 11:15:18 AM (11 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:
d8821e
Parents:
abfc95
git-author:
Frederik Heber <heber@…> (07/13/14 13:03:31)
git-committer:
Frederik Heber <heber@…> (07/14/14 11:15:18)
Message:

In CommandLineUI actions are skipped after failing action.

  • ActionQueue has queryable flag lastActionOk.
  • CommandLineWindow uses flag to check whether to queue further actions.
  • added regression test in the context of fragmentation-automation.
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Actions/ActionQueue.cpp

    rabfc95 ra61dbb  
    5858    AR(new ActionRegistry()),
    5959    history(new ActionHistory),
     60    CurrentAction(0),
    6061#ifndef HAVE_ACTION_THREAD
    61     CurrentAction(0)
     62    lastActionOk(true)
    6263#else
    63     CurrentAction(0),
     64    lastActionOk(true),
    6465    run_thread(boost::bind(&ActionQueue::run, this)),
    6566    run_thread_isIdle(true)
     
    99100  try {
    100101    newaction->call();
     102    lastActionOk = true;
    101103  } catch(ActionFailureException &e) {
    102104    std::cerr << "Action " << *boost::get_error_info<ActionNameString>(e) << " has failed." << std::endl;
    103105    World::getInstance().setExitFlag(5);
     106    actionqueue.clear();
     107    tempqueue.clear();
     108    lastActionOk = false;
     109    std::cerr << "ActionQueue cleared." << std::endl;
    104110  }
    105111#else
     
    156162      try {
    157163        actionqueue[CurrentAction]->call();
     164        lastActionOk = true;
    158165      } catch(ActionFailureException &e) {
    159166        std::cerr << "Action " << *boost::get_error_info<ActionNameString>(e) << " has failed." << std::endl;
    160167        World::getInstance().setExitFlag(5);
     168        actionqueue.clear();
     169        tempqueue.clear();
     170        lastActionOk = false;
     171        std::cerr << "ActionQueue cleared." << std::endl;
     172        CurrentAction = (size_t)-1;
    161173      }
    162174      // access actionqueue, hence using mutex
  • TabularUnified src/Actions/ActionQueue.hpp

    rabfc95 ra61dbb  
    122122  void redoLast();
    123123
     124  /** Return status of last executed action.
     125   *
     126   * \return true - action executed correctly, false - else
     127   */
     128  bool getLastActionOk() const
     129  {  return lastActionOk; }
     130
    124131#ifdef HAVE_ACTION_THREAD
    125132  boost::thread &getRunThread()
     
    205212  ActionQueue_t tempqueue;
    206213
     214  //!> indicates that the last action has failed
     215  bool lastActionOk;
     216
    207217#ifdef HAVE_ACTION_THREAD
    208218  //!> internal thread to call Actions
  • TabularUnified src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    rabfc95 ra61dbb  
    138138
    139139    // Phase Two: add MPQCJobs and send
    140     const size_t NoJobs = mpqccontroller.addJobsFromQueue(
     140    const bool AddJobsStatus = mpqccontroller.addJobsFromQueue(
    141141        params.DoLongrange.get() ? MPQCData::DoSampleDensity : MPQCData::DontSampleDensity,
    142142        params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly
    143143        );
    144     LOG(1, "INFO: Added " << NoJobs << " from FragmentJobsQueue.");
     144    if (AddJobsStatus)
     145      LOG(1, "INFO: Added jobs from FragmentJobsQueue.");
     146    else {
     147      ELOG(1, "Adding jobs failed.");
     148      return Action::failure;
     149    }
    145150    mpqccontroller.run();
    146151
  • TabularUnified src/Fragmentation/Automation/MPQCFragmentController.cpp

    rabfc95 ra61dbb  
    5757    )
    5858{
     59  bool status = true;
    5960  // give them all valid ids
    6061  std::vector<FragmentJob::ptr> newjobs = FragmentJobQueue::getInstance().getJobs();
     
    6566    job->DoLongrange = _DoLongrange;
    6667    job->DoValenceOnly = _DoValenceOnly;
    67     changeJobId((*jobiter), getAvailableId());
     68    JobId_t id = getAvailableId();
     69    if (id == FragmentJob::IllegalJob) {
     70      status = false;
     71      break;
     72    }
     73    changeJobId((*jobiter), id);
    6874  }
    6975  // add the jobs
    7076  addJobs(newjobs);
     77  status &= (newjobs.size() != 0);
    7178
    72   return (newjobs.size() != 0);
     79  return status;
    7380}
    7481
  • TabularUnified src/UIElements/CommandLineUI/CommandLineWindow.cpp

    rabfc95 ra61dbb  
    7272    if (AQ.isActionKnownByName(*CommandRunner)) {
    7373//      LOG1, "INFO: Checking presence of " << *CommandRunner << ": " << "queuing.");
    74       AQ.queueAction(*CommandRunner);
     74      if (AQ.getLastActionOk())
     75        AQ.queueAction(*CommandRunner);
     76      else
     77        LOG(1, "INFO: Skipping " << *CommandRunner << " as last action failed.");
    7578    } else {
    7679//      LOG(1, "INFO: Checking presence of " << *CommandRunner << ": " << "absent.");
  • TabularUnified tests/regression/Fragmentation/testsuite-fragmentation.at

    rabfc95 ra61dbb  
    3030# check storing saturated fragment
    3131m4_include([Fragmentation/StoreSaturatedFragment/testsuite-fragmentation-store-saturated-fragment.at])
     32
     33# check automation
     34m4_include([Fragmentation/FragmentationAutomation/testsuite-fragmentation-fragmentation-automation.at])
  • TabularUnified tests/regression/Makefile.am

    rabfc95 ra61dbb  
    7272        $(srcdir)/Fragmentation/testsuite-fragmentation.at \
    7373        $(srcdir)/Fragmentation/AnalyseFragmentationResults/testsuite-fragmentation-analyse-fragment-results.at \
     74        $(srcdir)/Fragmentation/FragmentationAutomation/testsuite-fragmentation-fragmentation-automation.at \
    7475        $(srcdir)/Fragmentation/FragmentMolecule/testsuite-fragmentation-fragment-molecule.at \
    7576        $(srcdir)/Fragmentation/FragmentMolecule-MaxOrder/testsuite-fragmentation-fragment-molecule-maxorder.at \
Note: See TracChangeset for help on using the changeset viewer.