]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Pre process command is now a script.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Mon, 18 Dec 2017 09:35:39 +0000 (10:35 +0100)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Mon, 18 Dec 2017 09:35:39 +0000 (10:35 +0100)
idl/SALOME_Launcher.idl
src/Launcher/CMakeLists.txt
src/Launcher/Launcher_Job.cxx
src/Launcher/Test/CTestTestfileInstall.cmake
src/Launcher/Test/test_launcher.py

index b3619363c77b9291cea34453519208f4ddd20c77..ca8a0248c4d7596ed8216db11126461dce3b5ef1 100644 (file)
@@ -66,8 +66,8 @@ struct JobParameters
   */
   string job_file;
 
-  //! Pre processing command.
-  /*! This command is called on the remote resource, from #work_directory, after
+  //! Pre processing script.
+  /*! This script is called on the remote resource, from #work_directory, after
       the copy of #in_files and before submiting the job.
   */
   string pre_command;
index e85ee37b1628edb26b8ac9ae71b8f02a2a921d83..4c8560db39e8cfb923dedfccf967e550e020b98b 100755 (executable)
@@ -40,7 +40,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_BINARY_DIR}/idl
 )
 
-ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${OMNIORB_DEFINITIONS})
+ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS})
 IF(SALOME_USE_LIBBATCH)
   ADD_DEFINITIONS(-DWITH_LIBBATCH)
 ENDIF(SALOME_USE_LIBBATCH)
@@ -56,6 +56,8 @@ SET(COMMON_LIBS
   SALOMELocalTrace
   SALOMEBasics
   SalomeIDLKernel
+  ${Boost_FILESYSTEM_LIBRARY}
+  ${Boost_SYSTEM_LIBRARY}
   ${LIBBATCH_LIBRARIES}
   ${OMNIORB_LIBRARIES}
   ${LIBXML2_LIBRARIES}
@@ -83,6 +85,8 @@ SET(TestLauncher_LIBS
   ResourcesManager
   Launcher
   ${LIBBATCH_LIBRARIES}
+  ${Boost_FILESYSTEM_LIBRARY}
+  ${Boost_SYSTEM_LIBRARY}
 )
 
 # TestLauncher needs only (and must need only) libxml, libbatch, ResourceManager and Launcher libraries!
index e3a2fc615c40a67d6370c03adbd64ae4b7bd9eee..e98e0f204ae4f1be22be19acc1f64f2b049b9c33 100644 (file)
@@ -22,6 +22,7 @@
 //#define _DEBUG_
 #include "Launcher_Job.hxx"
 #include "Launcher.hxx"
+#include <boost/filesystem.hpp>
 
 #ifdef WITH_LIBBATCH
 #include <libbatch/Constants.hxx>
@@ -617,7 +618,13 @@ Launcher::Job::common_job_params()
     }
   }
   params[Batch::WORKDIR] = _work_directory;
-  params[Batch::PREPROCESS] = _pre_command;
+  std::string libbatch_pre_command("");
+  if(!_pre_command.empty())
+  {
+    boost::filesystem::path pre_command_path(_pre_command);
+    libbatch_pre_command += "./" + pre_command_path.filename().string();
+  }
+  params[Batch::PREPROCESS] = libbatch_pre_command;
 
   // Parameters for COORM
   params[Batch::LAUNCHER_FILE] = _launcher_file;
@@ -632,6 +639,8 @@ Launcher::Job::common_job_params()
   in_files.push_back(_job_file);
   if (_env_file != "")
           in_files.push_back(_env_file);
+  if(!_pre_command.empty())
+     in_files.push_back(_pre_command);
   for(std::list<std::string>::iterator it = in_files.begin(); it != in_files.end(); it++)
   {
     std::string file = *it;
index 664c74c99ca0edfa285954595fb3b5a947cbcfa3..3d4df3a2d0251415da7372351d6552d0fe1342de 100644 (file)
@@ -19,7 +19,7 @@
 
 IF(NOT WIN32)
   SET(TEST_NAME ${COMPONENT_NAME}_Launcher)
-  ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} test_launcher.py)
+  ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} 2000 test_launcher.py)
   SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}"
     #                                                 TIMEOUT 500
     )
index b0bee509de0582e547500dc9756dda8d021c1d8d..991c05599daad92faba56e9ebe2bfdcfa513e854 100755 (executable)
@@ -466,7 +466,13 @@ f.close()
     mkdir_p(case_test_dir)
 
     # command to be run before the job
-    pre_command = "echo 'it works!' > in.txt"
+    pre_command = "pre_command.sh"
+    pre_command_text = "echo 'it works!' > in.txt"
+    abs_pre_command_file = os.path.join(case_test_dir, pre_command)
+    f = open(abs_pre_command_file, "w")
+    f.write(pre_command_text)
+    f.close()
+    os.chmod(abs_pre_command_file, 0o755)
     
     # job script
     script_file = "myTestScript.py"