mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-13 02:00:34 +05:00
Padder execution error management (the errors are raised toward the gui)
This commit is contained in:
parent
5d01c143df
commit
1c3d4eccd1
@ -76,7 +76,7 @@ module MESHJOB
|
||||
{
|
||||
string results_dirname;
|
||||
string outputmesh_filename;
|
||||
string status;
|
||||
boolean status;
|
||||
};
|
||||
|
||||
// This defines the possible states of a job
|
||||
|
@ -294,9 +294,9 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & m
|
||||
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;
|
||||
}
|
||||
@ -569,18 +569,28 @@ MESHJOB::MeshJobResults * MeshJobManager_i::finalize(CORBA::Long jobId) {
|
||||
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;
|
||||
|
@ -42,9 +42,9 @@ public:
|
||||
~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);
|
||||
|
@ -33,8 +33,8 @@ class SPADDERPluginTester_i:
|
||||
{
|
||||
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);
|
||||
|
@ -85,13 +85,22 @@ class ConfigReader:
|
||||
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
|
||||
|
||||
#
|
||||
# =========================================================================
|
||||
|
@ -340,14 +340,14 @@ class PluginDialog(QDialog):
|
||||
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)
|
||||
|
@ -22,7 +22,9 @@
|
||||
|
||||
# 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
|
||||
|
||||
#
|
||||
# =======================================================================
|
||||
@ -32,7 +34,7 @@
|
||||
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()
|
||||
@ -70,7 +72,15 @@ component.configure(configId,config)
|
||||
# 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")
|
||||
@ -90,7 +100,7 @@ def test00_parameters():
|
||||
|
||||
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")
|
||||
@ -115,7 +125,7 @@ def test01_parameters():
|
||||
|
||||
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")
|
||||
@ -127,7 +137,7 @@ def test02_parameters():
|
||||
|
||||
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")
|
||||
@ -209,4 +219,6 @@ else:
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user