-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
/*
* BatchManager_Local.cxx :
}
// Methode pour le controle des jobs : soumet un job au gestionnaire
- const JobId BatchManager_Local::submitJob(const Job & job)
+ const JobId BatchManager_Local::runJob(const Job & job)
{
- // export input files in the working directory of the execution host
- exportInputFiles(job);
-
Job_Local jobLocal = job;
Id id = _idCounter++;
ThreadAdapter * p_ta = new ThreadAdapter(*this, job, id);
fileToExecute = param[EXECUTABLE].str();
else
throw RunTimeException("param[EXECUTABLE] is not defined. Please define it, cannot submit this job.");
-
- string::size_type p1 = fileToExecute.find_last_of("/");
+#ifdef WIN32
+ const char separator = '\\';
+#else
+ const char separator = '/';
+#endif
+ string::size_type p1 = fileToExecute.find_last_of(separator);
string::size_type p2 = fileToExecute.find_last_of(".");
string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
string fileNameToExecute = fileToExecute.substr(p1+1);
- string remotePath = workDir + "/" + rootNameToExecute + "_launch_job";
+ string remotePath = workDir + separator + rootNameToExecute + "_launch_job";
// Create batch submit file
ofstream tempOutputFile;
child = p_ta->launchWin32ChildProcess();
p_ta->pere(child);
#else
+ // LOCK&UNLOCK needed to avoid potential deadlock if a thread holds the lock
+ LOCK_IO
child = fork();
+ UNLOCK_IO
if (child < 0) { // erreur
UNDER_LOCK( LOG("Fork impossible (rc=" << child << ")") );