Ignore:
Timestamp:
Apr 5, 2018, 1:19:33 PM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
Children:
354a5f
Parents:
322d58
git-author:
Frederik Heber <frederik.heber@…> (04/05/18 11:27:18)
git-committer:
Frederik Heber <frederik.heber@…> (04/05/18 13:19:33)
Message:

OperationQueue states when queue is empty (instead of all are running).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ThirdParty/JobMarket/src/JobMarket/Operations/OperationQueue.cpp

    r322d58 rbca6b6  
    7373  // connection available?
    7474  if (getNumberOfRunningOps() < max_connections) {
    75     // only start operation when address is valid
    76     OperationQueue_t::iterator queueiter =
    77         std::find_if(queue.begin(), queue.end(),
    78             boost::bind(&AddressMap_t::count, boost::ref(AddressMap), boost::lambda::_1) );
    79     if (queueiter != queue.end()) {
    80       const AddressMap_t::iterator mapiter = AddressMap.find(*queueiter);
    81       ASSERT( mapiter != AddressMap.end(),
    82           "OperationQueue::LaunchNextOp() - cannot find connection "+toString((*queueiter)->getName())+" in AddressMap.");
    83       currentOpsAddress = mapiter->second;
    84       const AsyncOp_ptr ptr = mapiter->first;
    85       // always erase the op from the list of ones pending for launch
    86       AddressMap.erase(mapiter);
    87       // only launch when not a debug op
    88       if ((!currentOpsAddress.host.empty()) && (!currentOpsAddress.service.empty())) {
    89         LOG(2, "DEBUG: Launching next operation " << ptr->getName() << ".");
    90        (*ptr)(currentOpsAddress.host, currentOpsAddress.service);
     75    if (!queue.empty()) {
     76      // only start operation when address is valid
     77      OperationQueue_t::iterator queueiter =
     78          std::find_if(queue.begin(), queue.end(),
     79              boost::bind(&AddressMap_t::count, boost::ref(AddressMap), boost::lambda::_1) );
     80      if (queueiter != queue.end()) {
     81        const AddressMap_t::iterator mapiter = AddressMap.find(*queueiter);
     82        ASSERT( mapiter != AddressMap.end(),
     83            "OperationQueue::LaunchNextOp() - cannot find connection "+toString((*queueiter)->getName())+" in AddressMap.");
     84        currentOpsAddress = mapiter->second;
     85        const AsyncOp_ptr ptr = mapiter->first;
     86        // always erase the op from the list of ones pending for launch
     87        AddressMap.erase(mapiter);
     88        // only launch when not a debug op
     89        if ((!currentOpsAddress.host.empty()) && (!currentOpsAddress.service.empty())) {
     90          LOG(2, "DEBUG: Launching next operation " << ptr->getName() << ".");
     91         (*ptr)(currentOpsAddress.host, currentOpsAddress.service);
     92        } else {
     93          LOG(3, "DEBUG: Skipping debug operation " << ptr->getName() << " with empty address.");
     94        }
    9195      } else {
    92         LOG(3, "DEBUG: Skipping debug operation " << ptr->getName() << " with empty address.");
     96        LOG(2, "DEBUG: All remaining operations are already running.");
    9397      }
    9498    } else {
    95       LOG(2, "DEBUG: All remaining operations are already running.");
     99      LOG(2, "DEBUG: There are no more operations in the queue.");
    96100    }
    97101  } else {
Note: See TracChangeset for help on using the changeset viewer.