]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
Merge V8_3_BR branch.
authorrnv <rnv@opencascade.com>
Tue, 30 May 2017 09:52:43 +0000 (12:52 +0300)
committerrnv <rnv@opencascade.com>
Tue, 30 May 2017 13:00:38 +0000 (16:00 +0300)
16 files changed:
CMakeLists.txt
bin/appliskel/salome_tester/salome_instance.py
bin/appliskel/tests/concurrentSession/TestMinimalExample.py
bin/nameserver.py
bin/runSession.py
bin/salomeContext.py
bin/salome_utils.py
src/Container/SALOME_ContainerManager.cxx
src/Launcher/BatchTest.cxx
src/Launcher/Launcher_Job.cxx
src/Launcher/Launcher_Job_Command.cxx
src/Launcher/Launcher_Job_SALOME.cxx
src/Launcher/Test/test_launcher.py
src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py
src/SALOMESDS/SALOMESDS_Transaction.cxx
src/Utils/Utils_Identity.cxx

index bf99f8ebb57fc46ff0cf7cdad8352f069797cec2..a1e000f2de88b3be9a538e23b801ef13bac38cbe 100755 (executable)
@@ -34,7 +34,7 @@ SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
 
 # Common CMake macros
 # ===================
index 8fb347e928580f7b8502438a1abed63a3d8fda2f..23bb9c3971bb1f681b201f0b96a6cb4ebb806d55 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2015-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
@@ -36,21 +36,22 @@ class SalomeInstance(object):
   @staticmethod
   def start(shutdown_servers=False, with_gui=False, args=[]):
     import tempfile
-    log = tempfile.NamedTemporaryFile(suffix='_nsport.log', delete=False)
+    log = tempfile.NamedTemporaryFile(suffix='_nsport', delete=True)
+    port_log = log.name
     log.close()
-
+    port_log = port_log + "-%s.log"%(os.getpid())
     instance_args = [
-      "--ns-port-log=%s"%log.name,
+      "--ns-port-log=%s"%port_log,
       "--shutdown-servers=%d"%shutdown_servers
       ] + args
 
     salome_instance = SalomeInstance()
     salome_instance.__run(args=instance_args, with_gui=with_gui)
 
-    with open(log.name) as f:
+    with open(port_log) as f:
       salome_instance.port = int(f.readline())
 
-    os.remove(log.name)
+    os.remove(port_log)
     return salome_instance
   #
 
index 0164535406b123eddb3caa111a8109225f44fb21..4498d6934cd86da8c1ab721c93339d270745c073 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# Copyright (C) 2013-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-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
@@ -68,18 +68,18 @@ class TestMinimalExample(unittest.TestCase):
     p.join()
 
     # Try to get specific port number
-    p = multiprocessing.Process(target=port_reservation, args=(obtained_ports, 2812, self,))
+    p = multiprocessing.Process(target=port_reservation, args=(obtained_ports, 2899, self, 2899,))
     p.start()
     p.join()
 
     # Release port
-    print "release port 2812"
-    p = multiprocessing.Process(target=releasePort, args=(2812,))
+    print "release port 2899"
+    p = multiprocessing.Process(target=releasePort, args=(2899,))
     p.start()
     p.join()
 
     # Try to get specific port number
-    p = multiprocessing.Process(target=port_reservation, args=(obtained_ports, 2812, self, 2812,))
+    p = multiprocessing.Process(target=port_reservation, args=(obtained_ports, 2899, self, 2899,))
     p.start()
     p.join()
 
index f9d1a3a2c6609fc6dfd643360a2aabef71aaa409..37061547ded443e8d1d94640695eb31972d94d6f 100755 (executable)
@@ -25,7 +25,7 @@
 import os, sys, re, socket
 #import commands
 from server import Server
-from Utils_Identity import getShortHostName
+from salome_utils import getHostName
 from launchConfigureParser import verbose
 
 # -----------------------------------------------------------------------------
@@ -46,13 +46,8 @@ class NamingServer(Server):
         except:
             pass
 
-        if verbose(): print "Name Service... ",
-        #hname=os.environ["HOST"] #commands.getoutput("hostname")
-        if sys.platform == "win32":
-          hname = getShortHostName();
-        else:
-          hname = socket.gethostname();
-        #print "hname=",hname
+        if verbose(): print "Name Service... "
+        hname = getHostName()
 
         with open(os.environ["OMNIORB_CONFIG"]) as f:
           ss = re.findall("NameService=corbaname::" + hname + ":\d+", f.read())
index c83ef01a1d4c7e3e3b18dd984d45e5338b90cb62..e06150138c4652ae3a0dc196398279837bf2aa55 100644 (file)
@@ -29,7 +29,7 @@ import socket
 import subprocess
 import re
 from salomeContextUtils import getScriptsAndArgs, formatScriptsAndArgs, getShortAndExtraArgs
-from salome_utils import getUserName
+from salome_utils import getUserName, getShortHostName
 
 # Use to display newlines (\n) in epilog
 class MyParser(OptionParser):
@@ -152,7 +152,7 @@ User "myself" connects to remotemachine to run the script concatenate.py in
   else:
     if not host:
       # only PORT is given
-      host = socket.gethostname()
+      host = getShortHostName()
     # both MACHINE and PORT are given
     _writeConfigFile(port, host)
   #
@@ -160,7 +160,7 @@ User "myself" connects to remotemachine to run the script concatenate.py in
   os.environ['NSHOST'] = host
 
   # determine running mode, taht is either 'local' or 'remote'
-  here = socket.gethostname()
+  here = getShortHostName()
   mode = "local"
   if host != here and host != "localhost" and host != "no_host":
     mode="remote"
index 2e63384f26fc032e2fb6ee6ffb3fe2687f0c588f..b08ee346729f88f9be86a134e0495df28a2ac876 100644 (file)
@@ -91,7 +91,7 @@ class SalomeContext:
     if len(configFileNames) == 0:
       raise SalomeContextException("No configuration files given")
 
-    reserved=['PATH', 'DYLD_FALLBACK_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'MANPATH', 'PV_PLUGIN_PATH', 'INCLUDE', 'LIBPATH', 'SALOME_PLUGINS_PATH', 'LIBRARY_PATH']
+    reserved=['PATH', 'DYLD_FALLBACK_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'MANPATH', 'PV_PLUGIN_PATH', 'INCLUDE', 'LIBPATH', 'SALOME_PLUGINS_PATH', 'LIBRARY_PATH', 'QT_PLUGIN_PATH']
     for filename in configFileNames:
       basename, extension = os.path.splitext(filename)
       if extension == ".cfg":
index 52a73fdd058bbe114b4c2c150bd3f72b1914455e..4f4936f97cf96b99315d7783f9959ebe43a35fc5 100644 (file)
@@ -148,7 +148,6 @@ def getHostName():
     3. if fails, try HOST environment variable
     4. if fails, return 'unknown' as default host name
     """
-    import os
     try:
         import socket
         host = socket.gethostname()
@@ -158,6 +157,11 @@ def getHostName():
     if not host: host = os.getenv("HOSTNAME")
     if not host: host = os.getenv("HOST")
     if not host: host = "unknown"           # 'unknown' is default host name
+    try:
+        socket.gethostbyname(host)
+    except:
+        host = "localhost"
+    pass
     return host
 
 # ---
index cb8e76656645ad6af343b558eabc939e583a340c..fcd1444b1e1f45e2b039c6724892e6ef6ee250d3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2017  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
@@ -1045,6 +1045,9 @@ std::string SALOME_ContainerManager::BuildTemporaryFileName()
 {
   //build more complex file name to support multiple salome session
   std::string aFileName = Kernel_Utils::GetTmpFileName();
+  std::ostringstream str_pid;
+  str_pid << ::getpid();
+  aFileName = aFileName + "-" + str_pid.str();
 #ifndef WIN32
   aFileName += ".sh";
 #else
@@ -1196,7 +1199,7 @@ std::string SALOME_ContainerManager::GetMPIZeroNode(const std::string machine, c
   std::string command;
   std::string tmpFile = BuildTemporaryFileName();
   const ParserResourcesType resInfo(_resManager->GetResourceDefinition(machine));
-  
+
   if(resInfo.Protocol == sh)
   {
     return resInfo.HostName;
@@ -2055,4 +2058,3 @@ SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command,
   return false;
 }
 #endif
-
index 788aca8b5a6c7c08df1e47f435be34d08e7b00a6..d81ef8a04b07510118e60e94c5636ec773ea1bd0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2017  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
@@ -22,6 +22,8 @@
 
 #include "BatchTest.hxx"
 #include "Launcher.hxx"
+#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
 
 #ifdef WITH_LIBBATCH
 #include <libbatch/MpiImpl.hxx>
@@ -47,10 +49,8 @@ BatchTest::BatchTest(const Engines::ResourceDefinition& batch_descr)
   strftime(date, BUFSIZE, "%Y_%m_%d__%H_%M_%S", localtime(&curtime));
 
   // Creating test temporary file
-  _test_filename =  "/tmp/";
-  _test_filename += std::string(date) + "_test_cluster_file_";
-  _test_filename += _batch_descr.hostname.in();
   _base_filename = std::string(date) + "_test_cluster_file_" + _batch_descr.hostname.in();
+  _test_filename = Kernel_Utils::GetTmpDir() + _base_filename;
 #endif
 }
 
index c52363bce918218c3b65c3333a1b799ebc7b3d8e..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()
 {
@@ -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
index 0fb681c35ec64b61bf012a48fe60a92699922afc..bdb0f2ec4e1303b156c0da7c7895b5443d6ef84d 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
@@ -31,6 +31,8 @@
 #define _chmod chmod
 #endif
 
+#include <sstream>
+
 Launcher::Job_Command::Job_Command() {_job_type = "command";}
 
 Launcher::Job_Command::~Job_Command() {}
@@ -46,7 +48,7 @@ Launcher::Job_Command::update_job()
 }
 
 #ifdef WITH_LIBBATCH
-std::string 
+std::string
 Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string launch_date)
 {
   // parameters
@@ -54,10 +56,12 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l
 
   // File name
   std::string launch_date_port_file = launch_date;
-  std::string launch_script = Kernel_Utils::GetTmpDir() + "runCommand_" + _job_file_name + "_" + launch_date + ".sh";
+  std::ostringstream str_pid;
+  str_pid << ::getpid();
+  std::string launch_script = Kernel_Utils::GetTmpDir() + "runCommand_" + _job_file_name + "_" + launch_date + "-" + str_pid.str() + ".sh";
   std::ofstream launch_script_stream;
   launch_script_stream.open(launch_script.c_str(), std::ofstream::out);
-   
+
   // Script
   launch_script_stream << "#!/bin/sh -f" << std::endl;
   launch_script_stream << "cd " << work_directory << std::endl;
index 75941e77bfbe56fc01c08fff884eae830da48ec0..ee2812c1b6f5cae12d61d3d316d198bb928ee3a9 100644 (file)
@@ -31,6 +31,8 @@
 #define _chmod chmod
 #endif
 
+#include <sstream>
+
 Launcher::Job_SALOME::Job_SALOME() {}
 
 Launcher::Job_SALOME::~Job_SALOME() {}
@@ -63,8 +65,9 @@ Launcher::Job_SALOME::buildSalomeScript(Batch::Parametre params)
 {
   // parameters
   std::string work_directory = params[Batch::WORKDIR].str();
-
-  std::string launch_script = Kernel_Utils::GetTmpDir() + "runSalome_" + _job_file_name + "_" + _launch_date + ".sh";
+  std::ostringstream str_pid;
+  str_pid << ::getpid();
+  std::string launch_script = Kernel_Utils::GetTmpDir() + "runSalome_" + _job_file_name + "_" + _launch_date + "-" + str_pid.str() + ".sh";
   std::ofstream launch_script_stream;
   launch_script_stream.open(launch_script.c_str(),
                             std::ofstream::out
index 53fe67af54fff949a236ac2290915f7f8255a1be..546b0057fda6241aad64b9d312a5edfc8c947078 100755 (executable)
@@ -5,6 +5,17 @@ import unittest
 import os
 import sys
 import time
+import tempfile
+import errno
+
+def mkdir_p(path):
+  try:
+    os.makedirs(path)
+  except OSError as exc:  # Python >2.5
+    if exc.errno == errno.EEXIST and os.path.isdir(path):
+      pass
+    else:
+      raise
 
 # Test of SalomeLauncher.
 # This test should be run in the salome environment, using "salome shell"
@@ -19,12 +30,13 @@ class TestCompo(unittest.TestCase):
   @classmethod
   def setUpClass(cls):
     # Prepare the test directory
-    import shutil
-    cls.test_dir = os.path.join(os.getcwd(), "test_dir")
-    cls.suffix = time.strftime("-%Y-%m-%d-%H-%M-%S")
-    shutil.rmtree(cls.test_dir, ignore_errors=True)
-    os.mkdir(cls.test_dir)
-    
+    temp = tempfile.NamedTemporaryFile()
+    cls.test_dir = os.path.join(temp.name, "test_dir")
+    name = os.path.basename(temp.name)
+    temp.close()
+    cls.suffix = time.strftime("-%Y-%m-%d-%H-%M-%S")+"-%s"%(os.getpid())
+    mkdir_p(cls.test_dir)
+
     # load catalogs
 #    mc = salome.naming_service.Resolve('/Kernel/ModulCatalog')
 #    ior = salome.orb.object_to_string(mc)
@@ -54,11 +66,11 @@ class TestCompo(unittest.TestCase):
   ##############################
   def test_salome_py_job(self):
     case_test_dir = os.path.join(TestCompo.test_dir, "salome_py")
-    os.mkdir(case_test_dir)
-    
+    mkdir_p(case_test_dir)
+
     old_dir = os.getcwd()
     os.chdir(case_test_dir)
-    
+
     # job script
     script_file = "myScript.py"
     job_script_file = os.path.join(case_test_dir, script_file)
@@ -82,8 +94,8 @@ f.close()
     f = open(job_script_file, "w")
     f.write(script_text)
     f.close()
-    
-    local_result_dir = os.path.join(case_test_dir, "result_py_job")
+
+    local_result_dir = os.path.join(case_test_dir, "result_py_job-")
     job_params = salome.JobParameters()
     job_params.job_type = "python_salome"
     job_params.job_file = job_script_file
@@ -91,9 +103,9 @@ f.close()
     job_params.out_files = ["result.txt", "subdir"]
     job_params.resource_required = salome.ResourceParameters()
     job_params.resource_required.nb_proc = 1
-    
+
     launcher = salome.naming_service.Resolve('/SalomeLauncher')
-    
+
     for resource in self.ressources:
       print "Testing python_salome job on ", resource
       job_params.result_directory = local_result_dir + resource
@@ -130,14 +142,14 @@ f.close()
       pass #for
 
     os.chdir(old_dir)
-    
+
   ##############################
   # test of command job type
   ##############################
   def test_command(self):
     case_test_dir = os.path.join(TestCompo.test_dir, "command")
-    os.mkdir(case_test_dir)
-    
+    mkdir_p(case_test_dir)
+
     # job script
     data_file = "in.txt"
     script_file = "myEnvScript.py"
@@ -166,7 +178,7 @@ f.close()
     f.write(script_text)
     f.close()
     os.chmod(abs_script_file, 0o755)
-    
+
     #environement script
     env_file = "myEnv.sh"
     env_text = """export ENV_TEST_VAR="expected"
@@ -174,14 +186,14 @@ f.close()
     f = open(os.path.join(case_test_dir, env_file), "w")
     f.write(env_text)
     f.close()
-    
+
     # write data file
     f = open(os.path.join(case_test_dir, data_file), "w")
     f.write("to be copied")
     f.close()
-    
+
     # job params
-    local_result_dir = os.path.join(case_test_dir, "result_com_job")
+    local_result_dir = os.path.join(case_test_dir, "result_com_job-")
     job_params = salome.JobParameters()
     job_params.job_type = "command"
     job_params.job_file = script_file
@@ -191,7 +203,7 @@ f.close()
     job_params.local_directory = case_test_dir
     job_params.resource_required = salome.ResourceParameters()
     job_params.resource_required.nb_proc = 1
-    
+
     # create and launch the job
     launcher = salome.naming_service.Resolve('/SalomeLauncher')
     resManager= salome.lcc.getResourcesManager()
@@ -205,7 +217,7 @@ f.close()
       # use the working directory of the resource
       resParams = resManager.GetResourceDefinition(resource)
       wd = os.path.join(resParams.working_directory,
-                        "CommandJob_" + self.suffix)
+                        "CommandJob" + self.suffix)
       job_params.work_directory = wd
 
       job_id = launcher.createJob(job_params)
@@ -247,10 +259,10 @@ f.close()
     yacs_path = os.getenv("YACS_ROOT_DIR", "")
     if not os.path.isdir(yacs_path):
       self.skipTest("Needs YACS module to run. Please define YACS_ROOT_DIR.")
-    
+
     case_test_dir = os.path.join(TestCompo.test_dir, "yacs")
-    os.mkdir(case_test_dir)
-    
+    mkdir_p(case_test_dir)
+
     #environement script
     env_file = "myEnv.sh"
     env_text = """export ENV_TEST_VAR="expected"
@@ -258,7 +270,7 @@ f.close()
     f = open(os.path.join(case_test_dir, env_file), "w")
     f.write(env_text)
     f.close()
-    
+
     # job script
     script_text = """<?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="newSchema_1">
@@ -285,14 +297,14 @@ f.close()
     f = open(job_script_file, "w")
     f.write(script_text)
     f.close()
-    
-    local_result_dir = os.path.join(case_test_dir, "result_yacs_job")
+
+    local_result_dir = os.path.join(case_test_dir, "result_yacs_job-")
     job_params = salome.JobParameters()
     job_params.job_type = "yacs_file"
     job_params.job_file = job_script_file
     job_params.env_file = os.path.join(case_test_dir,env_file)
     job_params.out_files = ["result.txt"]
-    
+
     # define the interval between two YACS schema dumps (3 seconds)
     import Engines
     job_params.specific_parameters = [Engines.Parameter("EnableDumpYACS", "3")]
@@ -301,7 +313,7 @@ f.close()
 
     launcher = salome.naming_service.Resolve('/SalomeLauncher')
     resManager= salome.lcc.getResourcesManager()
-    
+
     for resource in self.ressources:
       print "Testing yacs job on ", resource
       job_params.result_directory = local_result_dir + resource
@@ -311,7 +323,7 @@ f.close()
       # use the working directory of the resource
       resParams = resManager.GetResourceDefinition(resource)
       wd = os.path.join(resParams.working_directory,
-                        "YacsJob_" + self.suffix)
+                        "YacsJob" + self.suffix)
       job_params.work_directory = wd
 
       job_id = launcher.createJob(job_params)
@@ -352,7 +364,7 @@ f.close()
       launcher.getJobResults(job_id, "")
       self.verifyFile(os.path.join(job_params.result_directory, "result.txt"),
                       "expected")
-    
+
   ##############################
   # test of yacs job type using "--init_port" driver option
   ##############################
@@ -360,10 +372,10 @@ f.close()
     yacs_path = os.getenv("YACS_ROOT_DIR", "")
     if not os.path.isdir(yacs_path):
       self.skipTest("Needs YACS module to run. Please define YACS_ROOT_DIR.")
-    
+
     case_test_dir = os.path.join(TestCompo.test_dir, "yacs_opt")
-    os.mkdir(case_test_dir)
-    
+    mkdir_p(case_test_dir)
+
     # job script
     script_text = """<?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="myschema">
@@ -398,14 +410,14 @@ f.close()
     f = open(job_script_file, "w")
     f.write(script_text)
     f.close()
-    
-    local_result_dir = os.path.join(case_test_dir, "result_yacsopt_job")
+
+    local_result_dir = os.path.join(case_test_dir, "result_yacsopt_job-")
     job_params = salome.JobParameters()
     job_params.job_type = "yacs_file"
     job_params.job_file = job_script_file
     #job_params.env_file = os.path.join(case_test_dir,env_file)
     job_params.out_files = ["result.txt"]
-    
+
     # define the interval between two YACS schema dumps (3 seconds)
     import Engines
     job_params.specific_parameters = [Engines.Parameter("YACSDriverOptions",
@@ -416,7 +428,7 @@ f.close()
 
     launcher = salome.naming_service.Resolve('/SalomeLauncher')
     resManager= salome.lcc.getResourcesManager()
-    
+
     for resource in self.ressources:
       print "Testing yacs job with options on ", resource
       job_params.result_directory = local_result_dir + resource
@@ -426,7 +438,7 @@ f.close()
       # use the working directory of the resource
       resParams = resManager.GetResourceDefinition(resource)
       wd = os.path.join(resParams.working_directory,
-                        "YacsJobOpt_" + self.suffix)
+                        "YacsJobOpt" + self.suffix)
       job_params.work_directory = wd
 
       job_id = launcher.createJob(job_params)
@@ -452,4 +464,4 @@ if __name__ == '__main__':
     # creat study
     import salome
     salome.salome_init()
-    unittest.main()
\ No newline at end of file
+    unittest.main()
index ea3dd25adde26198e45da2379d0811e4ac331d19..793d3726f82271964df2ecc24df3f9f93ba2ed6c 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-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
@@ -18,6 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+import os
 import unittest
 import salome
 import Engines
@@ -38,45 +39,46 @@ Test with catalog :
 </resources>
 """
   def setUp(self):
+    self.container_name = "MyContainer-%s"%(os.getpid())
     pass
 
   def test0(self):
     """"""
     rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
-    p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="start",resource_params=rp)
+    p=LifeCycleCORBA.ContainerParameters(container_name=self.container_name,mode="start",resource_params=rp)
     co=cm.GiveContainer( p )
     host1=co.getHostName()
-    name1="/Containers/%s/MyContainer" % host1
+    name1="/Containers/%s/%s" % (host1,self.container_name)
     self.assertEqual(co._get_name(), name1)
     co=cm.GiveContainer( p )
     host2=co.getHostName()
-    name2="/Containers/%s/MyContainer" % host2
+    name2="/Containers/%s/%s" % (host2,self.container_name)
     self.assertEqual(co._get_name(), name2)
 
   def test1(self):
     """"""
     rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
-    p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="get",resource_params=rp)
+    p=LifeCycleCORBA.ContainerParameters(container_name=self.container_name,mode="get",resource_params=rp)
     co=cm.GiveContainer( p )
     host1=co.getHostName()
-    name1="/Containers/%s/MyContainer" % host1
+    name1="/Containers/%s/%s" % (host1,self.container_name)
     self.assertEqual(co._get_name(), name1)
     co=cm.GiveContainer( p )
     host2=co.getHostName()
-    name2="/Containers/%s/MyContainer" % host2
+    name2="/Containers/%s/%s" % (host2,self.container_name)
     self.assertEqual(co._get_name(), name2)
 
   def test2(self):
     """"""
     rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
-    p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="getorstart",resource_params=rp)
+    p=LifeCycleCORBA.ContainerParameters(container_name=self.container_name,mode="getorstart",resource_params=rp)
     co=cm.GiveContainer( p )
     host1=co.getHostName()
-    name1="/Containers/%s/MyContainer" % host1
+    name1="/Containers/%s/%s" % (host1,self.container_name)
     self.assertEqual(co._get_name(), name1)
     co=cm.GiveContainer( p )
     host2=co.getHostName()
-    name2="/Containers/%s/MyContainer" % host2
+    name2="/Containers/%s/%s" % (host2,self.container_name)
     self.assertEqual(co._get_name(), name2)
 
 
index 6d85116f9fee64520fb26b862f522f7738202668..26fd9affe464d43cb3b4f57c349c4df61cc192cf 100644 (file)
@@ -276,11 +276,12 @@ void TransactionMultiKeyAddSession::addKeyValueInVarErrorIfAlreadyExistingNow(co
   _dsct->checkVarExistingAndDict(_var_name);
   TransactionAddKeyValueErrorIfAlreadyExisting ret(_dsct,_var_name,key,value);
   {
-    bool mustRollback(true);
+    ret.perform();
+    /*bool mustRollback(true);
     TrustTransaction t;
     t.setTransaction(&ret,&mustRollback);
     t.operate();
-    mustRollback=false;//important let this line to notify t that everything was OK
+    mustRollback=false;//important let this line to notify t that everything was OK*/
   }
   ret.notify();
 }
index f989b62f650a6bccaf8cf1953d8060c821593413..04c2290c50b02a1ff4c0abf737869abdf7a52308 100644 (file)
@@ -71,6 +71,8 @@ const char* get_adip( void )
 #endif
 
         const hostent* pour_adip=gethostbyname(hostid.nodename);
+       if(pour_adip  == NULL)
+         pour_adip=gethostbyname("localhost");
         ASSERT(pour_adip!=NULL);
         const in_addr ip_addr=*(struct in_addr*)(pour_adip->h_addr) ;
         return duplicate(inet_ntoa(ip_addr));