From f55ac49782eb7a3390176df60fb9fb1d35e2edd3 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Tue, 17 Sep 2019 17:42:51 +0200 Subject: [PATCH] Some fixes on salome kill. --- bin/killSalomeWithPort.py | 2 +- bin/salomeContext.py | 29 +++++++++++++++-------------- src/Launcher/Test/test_launcher.py | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 4c6651a6a..7417f1899 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -342,7 +342,7 @@ def cleanApplication(port): try: filedict=getPiDict(port) - os.remove(filedict) + __killMyPort(port, filedict) except: #import traceback #traceback.print_exc() diff --git a/bin/salomeContext.py b/bin/salomeContext.py index ae0267c9d..37b3c9f31 100755 --- a/bin/salomeContext.py +++ b/bin/salomeContext.py @@ -396,31 +396,32 @@ class SalomeContext: print("Port number(s) not provided to command: salome kill ") return 1 - from multiprocessing import Process - from killSalomeWithPort import killMyPort - import tempfile + import subprocess + import setenv + setenv.main(True) + if os.getenv("NSHOST") == "no_host": + os.unsetenv("NSHOST") for port in ports: - with tempfile.NamedTemporaryFile(): - p = Process(target = killMyPort, args=(port,)) - p.start() - p.join() + proc = subprocess.Popen(["killSalomeWithPort.py", port]) + proc.communicate() + return 0 # def _killAll(self, unused=None): + import setenv + setenv.main(True) + if os.getenv("NSHOST") == "no_host": + os.unsetenv("NSHOST") try: import PortManager # mandatory - from multiprocessing import Process - from killSalomeWithPort import killMyPort + import subprocess ports = PortManager.getBusyPorts()['this'] if ports: - import tempfile for port in ports: - with tempfile.NamedTemporaryFile(): - p = Process(target = killMyPort, args=(port,)) - p.start() - p.join() + proc = subprocess.Popen(["killSalomeWithPort.py", port]) + proc.communicate() except ImportError: # :TODO: should be declared obsolete from killSalome import killAllPorts diff --git a/src/Launcher/Test/test_launcher.py b/src/Launcher/Test/test_launcher.py index bcdc822e6..c8280afb9 100755 --- a/src/Launcher/Test/test_launcher.py +++ b/src/Launcher/Test/test_launcher.py @@ -81,7 +81,7 @@ class TestCompo(unittest.TestCase): def create_JobParameters(self): job_params = salome.JobParameters() - job_params.wckey="P11U5:CARBONES" #needed by edf clusters + job_params.wckey="P11N0:SALOME" #needed by edf clusters job_params.resource_required = salome.ResourceParameters() job_params.resource_required.nb_proc = 1 return job_params -- 2.39.2