Salome HOME
23514: EDF 16031 - SMESH freezes
[modules/kernel.git] / src / Launcher / Launcher_Job.cxx
index bd574094fbbfd79d41a8e28ce2613141d6a51a36..e046fd8cfc14d88b8f5ed7a3fed573a1873bdb47 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2009-2017  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -27,7 +27,7 @@
 #include <libbatch/Constants.hxx>
 #endif
 
-using namespace std;
+#include <sstream>
 
 Launcher::Job::Job()
 {
@@ -518,7 +518,7 @@ Launcher::Job::getLaunchDate() const
   time_t rawtime;
   time(&rawtime);
   std::string launch_date = ctime(&rawtime);
-  int i = 0 ;
+  size_t i = 0 ;
   for (;i < launch_date.size(); i++)
     if (launch_date[i] == '/' ||
         launch_date[i] == '-' ||
@@ -590,7 +590,11 @@ Launcher::Job::common_job_params()
     strftime(date, BUFSIZE, "%Y_%m_%d__%H_%M_%S", localtime(&curtime));
     if(!_resource_definition.working_directory.empty())
     {
-      std::string job_dir = std::string("/job_") + date;
+      std::string date_dir = std::string("/job_") + date;
+      std::ostringstream str_pid;
+      str_pid << ::getpid();
+      std::string job_dir = date_dir + "-" + str_pid.str();
+
       _work_directory = _resource_definition.working_directory + job_dir;
     }
     else