Salome HOME
Moved username initialization to the constructor in BatchManager_eClients
[tools/libbatch.git] / src / LSF / Batch_BatchManager_eLSF.cxx
index fc36f7f48c8fb629572e258f6f50cf32e66bfa14..5b992b8b4bf5bebbe82440ca74d9f51cf7b382f2 100644 (file)
@@ -55,8 +55,9 @@ using namespace std;
 namespace Batch {
 
   BatchManager_eLSF::BatchManager_eLSF(const FactBatchManager * parent, const char * host,
+                                       const char * username,
                                        CommunicationProtocolType protocolType, const char * mpiImpl)
-  : BatchManager_eClient(parent, host, protocolType, mpiImpl),
+  : BatchManager_eClient(parent, host, username, protocolType, mpiImpl),
     BatchManager(parent, host)
   {
     // Nothing to do
@@ -281,6 +282,7 @@ namespace Batch {
     tempOutputFile << "cd " << workDir << endl ;
 
     // generate nodes file
+    tempOutputFile << "NODEFILE=`mktemp nodefile-XXXXXXXXXX` || exit 1" << endl;
     tempOutputFile << "bool=0" << endl;
     tempOutputFile << "for i in $LSB_MCPU_HOSTS; do" << endl;
     tempOutputFile << "  if test $bool = 0; then" << endl;
@@ -288,17 +290,21 @@ namespace Batch {
     tempOutputFile << "    bool=1" << endl;
     tempOutputFile << "  else" << endl;
     tempOutputFile << "    for ((j=0;j<$i;j++)); do" << endl;
-    tempOutputFile << "      echo $n >> nodesFile" << endl;
+    tempOutputFile << "      echo $n >> $NODEFILE" << endl;
     tempOutputFile << "    done" << endl;
     tempOutputFile << "    bool=0" << endl;
     tempOutputFile << "  fi" << endl;
     tempOutputFile << "done" << endl;
 
     // Abstraction of PBS_NODEFILE - TODO
-    tempOutputFile << "export LIBBATCH_NODEFILE=nodesFile" << endl;
+    tempOutputFile << "export LIBBATCH_NODEFILE=$NODEFILE" << endl;
 
     // Launch the executable
     tempOutputFile << "./" + fileNameToExecute << endl;
+
+    // Remove the node file
+    tempOutputFile << "rm $NODEFILE" << endl;
+
     tempOutputFile.flush();
     tempOutputFile.close();