Salome HOME
Merge from V1_3_BR
authorbarate <barate>
Tue, 19 Jul 2011 12:55:00 +0000 (12:55 +0000)
committerbarate <barate>
Tue, 19 Jul 2011 12:55:00 +0000 (12:55 +0000)
CMakeLists.txt
CMakeModules/FindPThread.cmake
src/LSF/Batch_JobInfo_eLSF.cxx
src/Slurm/Batch_BatchManager_eSlurm.cxx

index ab678ea5ad84c87e7a084634e2f7fa4baa4c4653..84797ca7d69e509738270f6893cc3844049a2a01 100644 (file)
@@ -56,7 +56,7 @@ SET(CPACK_GENERATOR TGZ)
 SET(CPACK_SOURCE_GENERATOR TGZ ZIP)
 SET(CPACK_PACKAGE_VERSION_MAJOR 1)
 SET(CPACK_PACKAGE_VERSION_MINOR 3)
-SET(CPACK_PACKAGE_VERSION_PATCH 0)
+SET(CPACK_PACKAGE_VERSION_PATCH 1)
 SET(CPACK_SOURCE_IGNORE_FILES /\\\\.;/CVS/;~)
 SET(CPACK_SOURCE_PACKAGE_FILE_NAME
     ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
index 43150446a629a7d2f529817aefa1422daf98979e..690fdfcdfc35c2b01d5ec4ee609fb9e90e52b12c 100644 (file)
@@ -24,8 +24,25 @@ IF (NOT PThread_FIND_QUIETLY)
     MESSAGE(STATUS "Looking for PThread...")
 ENDIF (NOT PThread_FIND_QUIETLY)
 
-FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h)
-FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread pthreadVC2) 
+IF(WIN32)
+    SET(PTHREADS_ROOT_USER $ENV{PTHREADS_ROOT})
+    SET(PTHREADS_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+    SET(PTHREADS_INCLUDE_TO_FIND pthread.h)
+    SET(PTHREADS_INCLUDE_PATHS ${PTHREADS_ROOT_USER}/include)
+    FIND_PATH(PTHREAD_INCLUDE_DIR ${PTHREADS_INCLUDE_TO_FIND}
+              PATHS ${PTHREADS_INCLUDE_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+    SET(PTHREADS_LIB_PATHS ${PTHREADS_ROOT_USER}/lib)
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+        FIND_LIBRARY(PTHREAD_LIBRARY pthreadVSE2 pthreadVC2
+                     PATHS ${PTHREADS_LIB_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+        FIND_LIBRARY(PTHREAD_LIBRARY pthreadVSE2d pthreadVC2d
+                     PATHS ${PTHREADS_LIB_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+ELSE(WIN32)
+    FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h)
+    FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread)
+ENDIF(WIN32)
 
 IF (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY)
     SET(PThread_FOUND True)
index e21056444df41cee93cd24a37f30474a710da2b9..349c5750e867de83966389bc05163b19cd96c556 100644 (file)
@@ -56,40 +56,46 @@ namespace Batch {
     _param[ID] = oss.str();
 
     // read status of job in log file
-    char line[128];
-    ifstream fp(logFile.c_str(),ios::in);
-    fp.getline(line,80,'\n');
-    
-    string sjobid, username, status;
-    fp >> sjobid;
-    fp >> username;
-    fp >> status;
-
-    if (status == "PEND") {         // Pending
-      _param[STATE] = QUEUED;
-    } else if (status == "PSUSP") { // Suspended while pending
-      _param[STATE] = PAUSED;
-    } else if (status == "RUN") {   // Running
-      _param[STATE] = RUNNING;
-    } else if (status == "USUSP") { // Suspended while running
-      _param[STATE] = PAUSED;
-    } else if (status == "SSUSP") { // Suspended by LSF
-      _param[STATE] = PAUSED;
-    } else if (status == "DONE") {  // Finished successfully
+    string line;
+    ifstream fp(logFile.c_str());
+    getline(fp, line);
+
+    // On some batch managers, the job is deleted soon after it is finished,
+    // so we have to consider that an unknown job (empty file) is a finished
+    // one, even if it is not always true.
+    if (fp.eof()) {
       _param[STATE] = FINISHED;
-    } else if (status == "EXIT") {  // Finished in error
-      _param[STATE] = FAILED;
-    } else if (status == "UNKWN") { // Lost contact
-      _param[STATE] = FAILED;
-    } else if (status == "ZOMBI") { // Zombie
-      _param[STATE] = FAILED;
     } else {
-      cerr << "Unknown job state code: " << status << endl;
+      string sjobid, username, status;
+      fp >> sjobid;
+      fp >> username;
+      fp >> status;
+
+      if (status == "PEND") {         // Pending
+        _param[STATE] = QUEUED;
+      } else if (status == "PSUSP") { // Suspended while pending
+        _param[STATE] = PAUSED;
+      } else if (status == "RUN") {   // Running
+        _param[STATE] = RUNNING;
+      } else if (status == "USUSP") { // Suspended while running
+        _param[STATE] = PAUSED;
+      } else if (status == "SSUSP") { // Suspended by LSF
+        _param[STATE] = PAUSED;
+      } else if (status == "DONE") {  // Finished successfully
+        _param[STATE] = FINISHED;
+      } else if (status == "EXIT") {  // Finished in error
+        _param[STATE] = FAILED;
+      } else if (status == "UNKWN") { // Lost contact
+        _param[STATE] = FAILED;
+      } else if (status == "ZOMBI") { // Zombie
+        _param[STATE] = FAILED;
+      } else {
+        cerr << "Unknown job state code: " << status << endl;
+      }
+
+      if( status.find("RUN") != string::npos)
+        _running = true;
     }
-
-    if( status.find("RUN") != string::npos)
-      _running = true;
-
   }
 
   // Teste si un job est present en machine
index e20775bfda15b181d47993e74e022a466131af08..c6bcbc8f486203a543baddcb0db70c6de347f50f 100644 (file)
@@ -242,9 +242,10 @@ namespace Batch {
     command += " > ";
     command += logFile;
     cerr << command.c_str() << endl;
-    int status = system(command.c_str());
-    if (status != 0)
-      throw EmulationException("Can't query job " + jobid.getReference());
+    system(command.c_str());
+    // We don't test the return code here because with jobs finished since a long time Slurm
+    // returns an error and a message like "slurm_load_jobs error: Invalid job id specified".
+    // So we consider that the job is finished when we get an error.
 
     JobInfo_eSlurm jobinfo = JobInfo_eSlurm(jobid.getReference(), logFile);
     return jobinfo;