{
string results_dirname;
string outputmesh_filename;
- string status;
+ boolean status;
};
// This defines the possible states of a job
break;
default:
_lastErrorMessage =
- std::string("The type of the file ")+
- std::string(currentMesh.file_name)+
- std::string(" is not recognized");
+ std::string("The type of the file ")+
+ std::string(currentMesh.file_name)+
+ std::string(" is not recognized");
LOG(_lastErrorMessage);
return JOBID_UNDEFINED;
}
rename((local_resultdir+"/"+OUTPUTFILE).c_str(), (local_resultdir+"/"+outputFileName).c_str());
result->outputmesh_filename = outputFileName.c_str();
- result->status = "OK";
+
+ if ( fexists( (local_resultdir+"/"+outputFileName).c_str() ) != true ) {
+ _lastErrorMessage = std::string("The result file ")+
+ std::string((local_resultdir+"/"+outputFileName).c_str())+
+ std::string(" has not been created.");
+ result->status = false;
+ }
+ else {
+ result->status = true;
+ }
}
catch (const SALOME::SALOME_Exception & ex)
{
- LOG("SALOME Exception in getResults !");
- result->status = "SALOME Exception in getResults !";
_lastErrorMessage = ex.details.text.in();
+ LOG(_lastErrorMessage);
+ result->status = false;
}
catch (const CORBA::SystemException& ex)
{
- LOG("Receive CORBA System Exception: " << ex);
- result->status = "Receive CORBA System Exception: see log";
+ _lastErrorMessage = "The SALOME launcher can not retrieve the result data";
+ LOG(_lastErrorMessage);
+ result->status = false;
}
endService("MeshJobManager_i::getResults");
return result;
~MeshJobManager_i();
bool configure (const char *configId,
- const MESHJOB::ConfigParameter & configParameter);
+ const MESHJOB::ConfigParameter & configParameter);
CORBA::Long initialize (const MESHJOB::MeshJobParameterList & meshJobParameterList,
- const char *configId);
+ const char *configId);
bool start (CORBA::Long jobId);
char* getState (CORBA::Long jobId);
MESHJOB::MeshJobResults * finalize(CORBA::Long jobId);
{
public:
SPADDERPluginTester_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName, const char *interfaceName);
+ PortableServer::ObjectId * contId,
+ const char *instanceName, const char *interfaceName);
virtual ~SPADDERPluginTester_i();
void demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c);
return TYPE_LOCAL
return defaultType
-
def printConfig(config):
print "PADDER CONFIGURATION:"
print "\tconfig.resname = %s"%config.resname
print "\tconfig.binpath = %s"%config.binpath
print "\tconfig.envpath = %s"%config.envpath
+def getPadderTestDir(config):
+ """
+ This function returns the directory of the SpherePadder
+ installation, where the tests cases are located. This should be
+ used for test only. It makes the hypothesis that the binpath to
+ the executable program is a path of the executable program of a
+ complete installation of SpherePadder.
+ """
+ testdir=os.path.join(os.path.abspath(os.path.dirname(config.binpath)),"tests")
+ return testdir
#
# =========================================================================
return
meshJobResults = jobManager.finalize(self.__jobid)
- if state == "ERROR":
- self.__log("ERR: jobid = "+str(self.__jobid)+" ended with error: "+meshJobResults.status)
- self.__log("ERR: %s"%jobManager.getLastErrorMessage())
+ logsdirname = os.path.join(meshJobResults.results_dirname, "logs")
+ if state == "ERROR" or meshJobResults.status is not True:
+ msgtemp = "ERR: jobid = %s ended with error: %s"
+ self.__log(msgtemp%(str(self.__jobid),jobManager.getLastErrorMessage()))
+ self.__log("ERR: see log files in %s"%logsdirname)
return
- logsdirname = os.path.join(meshJobResults.results_dirname, "logs")
- self.__log("INF: jobid="+str(self.__jobid)+" ended normally : "+meshJobResults.status)
- self.__log("INF: jobid="+str(self.__jobid)+" see log files in : "+logsdirname)
+ self.__log("INF: jobid=%s ended normally (see log files in %s)"%(str(self.__jobid),logsdirname))
medfilename = os.path.join(meshJobResults.results_dirname,
meshJobResults.outputmesh_filename)
# This script illustrates the standard use case of the component
# MeshJobManager from within a SALOME script. It could be used as a
-# unit test of the component.
+# unit test of the component. The typical procedure is:
+# $ <appli>/runAppli -t
+# $ <appli>/runSession </path/to>/usecase_meshJobManager.py
#
# =======================================================================
import sys
import os
import time
-from salome.smesh.spadder.configreader import ConfigReader, printConfig
+from salome.smesh.spadder.configreader import ConfigReader, printConfig, getPadderTestDir
configReader = ConfigReader()
defaultConfig = configReader.getDefaultConfig()
# for testing the component. The test function number corresponds to
# the number of the test defined in the SpherePadder installation
# directory.
-
+PADDERTESTDIR = getPadderTestDir(defaultConfig)
+#PADDERTESTDIR = spadder.getTestPadderDataDir()
+#
+# WARN: the above instruction (spadder.getTestPadderDataDir())
+# localizes the PADDERTEST DIR using the PADDERDIR shell variable,
+# while the previous one (getPadderTestDir) localizes this directory
+# from data of the config (read from the configuration file
+# padder.cfg).
+#
def test00_parameters():
"""Test using a concrete mesh and a single steelbar mesh"""
file_concrete=os.path.join(spadder.getTestDataDir(),"concrete.med")
def test01_parameters():
"""One concrete mesh and two steelbar meshes"""
- datadir = os.path.join(spadder.getTestPadderDataDir(),"test01")
+ datadir = os.path.join(PADDERTESTDIR,"test01")
meshJobParameterList = []
medfile = os.path.join(datadir,"concrete.med")
def test02_parameters():
"""One steelbar mesh only, without a concrete mesh"""
- datadir = os.path.join(spadder.getTestPadderDataDir(),"test02")
+ datadir = os.path.join(PADDERTESTDIR,"test02")
meshJobParameterList = []
medfile = os.path.join(datadir,"cadreef.med")
def test03_parameters():
"""One concrete mesh only, without a steelbar mesh"""
- datadir = os.path.join(spadder.getTestPadderDataDir(),"test03")
+ datadir = os.path.join(PADDERTESTDIR,"test03")
meshJobParameterList = []
medfile = os.path.join(datadir,"concrete.med")
print "OK: jobid = "+str(jobid)+" ended with state="+str(state)
meshJobResults = component.finalize(jobid)
print meshJobResults
- print "You will find the results files in the directory:\n%s"%meshJobResults.results_dirname
+ 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