From: Cédric Aguerre Date: Tue, 25 Apr 2017 11:45:06 +0000 (+0200) Subject: add pid number to container name [2] X-Git-Tag: Before_multi_study_removal_06072017~7^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fagr%2Ffor83rc;p=modules%2Fkernel.git add pid number to container name [2] --- diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index cb8e76656..fcd1444b1 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -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 - diff --git a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py index ea3dd25ad..793d3726f 100644 --- a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py +++ b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py @@ -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 : """ 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)