X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPython%2FTest%2FTest_Python_Local_SH.py;h=727ce1c6959c6a56d416cb8c14a4f139829e7d85;hb=b4e59846fd2eaf893548f182645e7162da4ad731;hp=b013b0b5b4c2ba9a288af4f42fc3a68bef6bd3d2;hpb=2a465e51fe8c18f5732714dfba052d568ed0e716;p=tools%2Flibbatch.git diff --git a/src/Python/Test/Test_Python_Local_SH.py b/src/Python/Test/Test_Python_Local_SH.py index b013b0b..727ce1c 100644 --- a/src/Python/Test/Test_Python_Local_SH.py +++ b/src/Python/Test/Test_Python_Local_SH.py @@ -1,23 +1,23 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2021 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 # import config @@ -25,82 +25,78 @@ import os import sys import time -# Import libBatch library -from libBatch_Swig import * +# Import libbatch library +from libbatch import * def work(): - print "*******************************************************************************************" - print "This script tests the local batch submission based on SH. No specific configuration is" - print "needed for this test." - print "*******************************************************************************************" + print("*******************************************************************************************") + print("This script tests the local batch submission based on SH. No specific configuration is") + print("needed for this test.") + print("*******************************************************************************************") # eventually remove any previous result - if (os.path.exists('result.txt')): - os.remove('result.txt') + if (os.path.exists("resultdir/seconddirname/result.txt")): + os.remove("resultdir/seconddirname/result.txt") # Define the job... job = Job() # ... and its parameters ... p = {} - p['EXECUTABLE'] = './copied-' + config.EXEC_TEST_NAME - p["ARGUMENTS"] = ["copied-seta.sh", "copied-setb.sh", "orig-result.txt"]; - p['NAME'] = 'Test_Python_Local_SH' - p['WORKDIR'] = config.TEST_LOCAL_SH_WORK_DIR - p['INFILE'] = [('seta.sh', 'copied-seta.sh'), ('setb.sh', 'copied-setb.sh'), - (config.EXEC_TEST_FULL_PATH, 'copied-' + config.EXEC_TEST_NAME)] - p['OUTFILE'] = [('result.txt', 'orig-result.txt')] + p[EXECUTABLE] = config.TEST_SOURCE_DIR + "/test_script.py"; + p[ARGUMENTS] = ["copied_seta.py", "copied_setb.py", "orig_result.txt"]; + p[NAME] = 'Test_Python_Local_SH' + p[WORKDIR] = config.TEST_LOCAL_SH_WORKDIR + p[INFILE] = [(config.TEST_SOURCE_DIR + '/seta.py', 'copied_seta.py'), + (config.TEST_SOURCE_DIR + '/setb.py', 'copied_setb.py')] + p[OUTFILE] = [('result.txt', 'orig_result.txt')] job.setParametre(p) # ... and its environment e = {} + e["MYENVVAR"] = "MYVALUE"; job.setEnvironnement(e) - print job + print(job) # Get the catalog c = BatchManagerCatalog.getInstance() - # Create a BatchManager of type Local_SSH on localhost - bm = c('SH')('localhost') + # Create a BatchManager of type Local_SH on localhost + bm = c('LOCAL')('localhost', '', SH) # Submit the job to the BatchManager jobid = bm.submitJob(job) - print jobid + print(jobid) # Query the job jobid.queryJob() # Wait for the end of the job - state = 'Unknown' - i=0 - while state != FINISHED and state != FAILED and i