Salome HOME
Copyright update 2020
[modules/smesh.git] / src / Tools / padder / unittests / usecase_meshJobManager.py
index 131e7c3157aad3adadf26228826a6f0f60a594a9..53be7a76e9f4759aac187b64cfccb72615267538 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: iso-8859-1 -*-
-# Copyright (C) 2011-2016  EDF R&D
+# Copyright (C) 2011-2020  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -83,7 +83,7 @@ PADDERTESTDIR = getPadderTestDir(defaultConfig)
 # padder.cfg).
 #
 def test00_parameters():
-    """Test using a concrete mesh and a single steelbar mesh""" 
+    """Test using a concrete mesh and a single steelbar mesh"""
     file_concrete=os.path.join(spadder.getTestDataDir(),"concrete.med")
     file_steelbar=os.path.join(spadder.getTestDataDir(),"ferraill.med")
 
@@ -109,7 +109,7 @@ def test01_parameters():
                                      file_type=MESHJOB.MED_CONCRETE,
                                      group_name="concrete")
     meshJobFileList.append(param)
-    
+
     medfile = os.path.join(datadir,"ferraill.med")
     param = MESHJOB.MeshJobFile(file_name=medfile,
                                      file_type=MESHJOB.MED_STEELBAR,
@@ -121,7 +121,7 @@ def test01_parameters():
                                      file_type=MESHJOB.MED_STEELBAR,
                                      group_name="ferrtran")
     meshJobFileList.append(param)
-    
+
     return meshJobFileList
 
 def test02_parameters():
@@ -161,7 +161,7 @@ def test03_parameters():
 meshJobFileList = test03_parameters()
 
 meshJobParameterList = []
-param = MESHJOB.MeshJobParameter(name="RminRmax",value="1.5")
+param = MESHJOB.MeshJobParameter(name="RmaxRmin",value="1.5")
 meshJobParameterList.append(param)
 param = MESHJOB.MeshJobParameter(name="NbIteration",value="3")
 meshJobParameterList.append(param)
@@ -172,14 +172,14 @@ meshJobParameterList.append(param)
 jobid = component.initialize(meshJobFileList, meshJobParameterList, configId)
 if jobid<0:
     msg = component.getLastErrorMessage()
-    print "ERR: %s"%msg
+    print("ERR: %s"%msg)
     sys.exit(1)
-    
+
 created = False
 nbiter  = 0
 while not created:
     state = component.getState(jobid)
-    print "MeshJobManager ["+str(nbiter)+"] : state = "+str(state)
+    print("MeshJobManager ["+str(nbiter)+"] : state = "+str(state))
     if state == "CREATED":
         created = True
     time.sleep(0.5)
@@ -196,10 +196,10 @@ while not created:
 ok=component.start(jobid)
 if not ok:
     msg = component.getLastErrorMessage()
-    print "ERR: %s"%msg
+    print("ERR: %s"%msg)
     sys.exit(1)
 
-print "job started: %s"%ok
+print("job started: %s"%ok)
 
 #
 # This part illustrates how you can follow the execution of the job.
@@ -212,20 +212,20 @@ ended  = False
 nbiter = 0
 while not ended:
     state = component.getState(jobid)
-    print "MeshJobManager ["+str(nbiter)+"] : state = "+str(state)
+    print("MeshJobManager ["+str(nbiter)+"] : state = "+str(state))
     if state not in run_states:
         ended=True
     time.sleep(0.5)
     nbiter+=1
-        
+
 if state not in end_states:
-    print "ERR: jobid = "+str(jobid)+" ended abnormally with state="+str(state)
+    print("ERR: jobid = "+str(jobid)+" ended abnormally with state="+str(state))
     msg = component.getLastErrorMessage()
-    print "ERR: %s"%msg    
+    print("ERR: %s"%msg)
 else:
-    print "OK:  jobid = "+str(jobid)+" ended with state="+str(state)
+    print("OK:  jobid = "+str(jobid)+" ended with state="+str(state))
     meshJobResults = component.finalize(jobid)
-    print meshJobResults
+    print(meshJobResults)
     if meshJobResults.status is not True:
-        print "ERR: the results are not OK: %s"%component.getLastErrorMessage()
-        print "ERR: see log files in %s"%meshJobResults.results_dirname
+        print("ERR: the results are not OK: %s"%component.getLastErrorMessage())
+        print("ERR: see log files in %s"%meshJobResults.results_dirname)