Changeset 365a44


Ignore:
Timestamp:
Sep 17, 2014, 10:33:09 PM (11 years ago)
Author:
Frederik Heber <heber@…>
Children:
019b96
Parents:
c4c20a
git-author:
Frederik Heber <heber@…> (05/22/14 16:18:35)
git-committer:
Frederik Heber <heber@…> (09/17/14 22:33:09)
Message:

Added loop to SystemCommandJob to attempt execution three times.

Location:
src/Jobs/JobMarket
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Jobs/JobMarket/SystemCommandJob.cpp

    rc4c20a r365a44  
    6464#include "CodePatterns/Log.hpp"
    6565#include "CodePatterns/toString.hpp"
     66
     67// static entities
     68const unsigned int SystemCommandJob::MAX_ATTEMPTS = 3;
    6669
    6770/** Constructor for class SystemCommandJob.
     
    140143  Chronos::getInstance().startTiming(WorkName);
    141144  FragmentResult::ptr s;
    142   {
     145  int exitflag = 255;
     146  for(unsigned int counter = 0;
     147      (counter < MAX_ATTEMPTS) && (exitflag != 0);
     148      ++counter) {
    143149    // open process
    144150    std::string command_args = command+std::string(" ")+tmpTemplate;
     
    153159    }
    154160
    155     int exitflag;
    156161    // read stdout from process
    157162    const int fd = fileno(stdoutstream);
     
    171176
    172177    if (exitflag != 0)
    173       ELOG(1, "Job " << getId() << " failed on executing: " << command_args);
    174     s->exitflag = exitflag;
    175   }
     178      ELOG(1, "Job " << getId() << " on attempt #" << counter+1
     179          << " failed on executing: " << command_args);
     180  }
     181  s->exitflag = exitflag;
    176182  Chronos::getInstance().endTiming(WorkName);
    177183
  • src/Jobs/JobMarket/SystemCommandJob.hpp

    rc4c20a r365a44  
    7878
    7979private:
     80  //!> number of maximum attempts to run fragment job
     81  static const unsigned int MAX_ATTEMPTS;
     82
     83private:
    8084  friend class boost::serialization::access;
    8185  // serialization
Note: See TracChangeset for help on using the changeset viewer.