mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-26 23:00:32 +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 results_dirname;
|
||||||
string outputmesh_filename;
|
string outputmesh_filename;
|
||||||
string status;
|
boolean status;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This defines the possible states of a job
|
// This defines the possible states of a job
|
||||||
|
@ -294,9 +294,9 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & m
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_lastErrorMessage =
|
_lastErrorMessage =
|
||||||
std::string("The type of the file ")+
|
std::string("The type of the file ")+
|
||||||
std::string(currentMesh.file_name)+
|
std::string(currentMesh.file_name)+
|
||||||
std::string(" is not recognized");
|
std::string(" is not recognized");
|
||||||
LOG(_lastErrorMessage);
|
LOG(_lastErrorMessage);
|
||||||
return JOBID_UNDEFINED;
|
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());
|
rename((local_resultdir+"/"+OUTPUTFILE).c_str(), (local_resultdir+"/"+outputFileName).c_str());
|
||||||
|
|
||||||
result->outputmesh_filename = 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)
|
catch (const SALOME::SALOME_Exception & ex)
|
||||||
{
|
{
|
||||||
LOG("SALOME Exception in getResults !");
|
|
||||||
result->status = "SALOME Exception in getResults !";
|
|
||||||
_lastErrorMessage = ex.details.text.in();
|
_lastErrorMessage = ex.details.text.in();
|
||||||
|
LOG(_lastErrorMessage);
|
||||||
|
result->status = false;
|
||||||
}
|
}
|
||||||
catch (const CORBA::SystemException& ex)
|
catch (const CORBA::SystemException& ex)
|
||||||
{
|
{
|
||||||
LOG("Receive CORBA System Exception: " << ex);
|
_lastErrorMessage = "The SALOME launcher can not retrieve the result data";
|
||||||
result->status = "Receive CORBA System Exception: see log";
|
LOG(_lastErrorMessage);
|
||||||
|
result->status = false;
|
||||||
}
|
}
|
||||||
endService("MeshJobManager_i::getResults");
|
endService("MeshJobManager_i::getResults");
|
||||||
return result;
|
return result;
|
||||||
|
@ -42,9 +42,9 @@ public:
|
|||||||
~MeshJobManager_i();
|
~MeshJobManager_i();
|
||||||
|
|
||||||
bool configure (const char *configId,
|
bool configure (const char *configId,
|
||||||
const MESHJOB::ConfigParameter & configParameter);
|
const MESHJOB::ConfigParameter & configParameter);
|
||||||
CORBA::Long initialize (const MESHJOB::MeshJobParameterList & meshJobParameterList,
|
CORBA::Long initialize (const MESHJOB::MeshJobParameterList & meshJobParameterList,
|
||||||
const char *configId);
|
const char *configId);
|
||||||
bool start (CORBA::Long jobId);
|
bool start (CORBA::Long jobId);
|
||||||
char* getState (CORBA::Long jobId);
|
char* getState (CORBA::Long jobId);
|
||||||
MESHJOB::MeshJobResults * finalize(CORBA::Long jobId);
|
MESHJOB::MeshJobResults * finalize(CORBA::Long jobId);
|
||||||
|
@ -33,8 +33,8 @@ class SPADDERPluginTester_i:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SPADDERPluginTester_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa,
|
SPADDERPluginTester_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa,
|
||||||
PortableServer::ObjectId * contId,
|
PortableServer::ObjectId * contId,
|
||||||
const char *instanceName, const char *interfaceName);
|
const char *instanceName, const char *interfaceName);
|
||||||
virtual ~SPADDERPluginTester_i();
|
virtual ~SPADDERPluginTester_i();
|
||||||
|
|
||||||
void demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c);
|
void demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c);
|
||||||
|
@ -85,13 +85,22 @@ class ConfigReader:
|
|||||||
return TYPE_LOCAL
|
return TYPE_LOCAL
|
||||||
return defaultType
|
return defaultType
|
||||||
|
|
||||||
|
|
||||||
def printConfig(config):
|
def printConfig(config):
|
||||||
print "PADDER CONFIGURATION:"
|
print "PADDER CONFIGURATION:"
|
||||||
print "\tconfig.resname = %s"%config.resname
|
print "\tconfig.resname = %s"%config.resname
|
||||||
print "\tconfig.binpath = %s"%config.binpath
|
print "\tconfig.binpath = %s"%config.binpath
|
||||||
print "\tconfig.envpath = %s"%config.envpath
|
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
|
return
|
||||||
|
|
||||||
meshJobResults = jobManager.finalize(self.__jobid)
|
meshJobResults = jobManager.finalize(self.__jobid)
|
||||||
if state == "ERROR":
|
logsdirname = os.path.join(meshJobResults.results_dirname, "logs")
|
||||||
self.__log("ERR: jobid = "+str(self.__jobid)+" ended with error: "+meshJobResults.status)
|
if state == "ERROR" or meshJobResults.status is not True:
|
||||||
self.__log("ERR: %s"%jobManager.getLastErrorMessage())
|
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
|
return
|
||||||
|
|
||||||
logsdirname = os.path.join(meshJobResults.results_dirname, "logs")
|
self.__log("INF: jobid=%s ended normally (see log files in %s)"%(str(self.__jobid),logsdirname))
|
||||||
self.__log("INF: jobid="+str(self.__jobid)+" ended normally : "+meshJobResults.status)
|
|
||||||
self.__log("INF: jobid="+str(self.__jobid)+" see log files in : "+logsdirname)
|
|
||||||
|
|
||||||
medfilename = os.path.join(meshJobResults.results_dirname,
|
medfilename = os.path.join(meshJobResults.results_dirname,
|
||||||
meshJobResults.outputmesh_filename)
|
meshJobResults.outputmesh_filename)
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
# This script illustrates the standard use case of the component
|
# This script illustrates the standard use case of the component
|
||||||
# MeshJobManager from within a SALOME script. It could be used as a
|
# 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 sys
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from salome.smesh.spadder.configreader import ConfigReader, printConfig
|
from salome.smesh.spadder.configreader import ConfigReader, printConfig, getPadderTestDir
|
||||||
|
|
||||||
configReader = ConfigReader()
|
configReader = ConfigReader()
|
||||||
defaultConfig = configReader.getDefaultConfig()
|
defaultConfig = configReader.getDefaultConfig()
|
||||||
@ -70,7 +72,15 @@ component.configure(configId,config)
|
|||||||
# for testing the component. The test function number corresponds to
|
# for testing the component. The test function number corresponds to
|
||||||
# the number of the test defined in the SpherePadder installation
|
# the number of the test defined in the SpherePadder installation
|
||||||
# directory.
|
# 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():
|
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_concrete=os.path.join(spadder.getTestDataDir(),"concrete.med")
|
||||||
@ -90,7 +100,7 @@ def test00_parameters():
|
|||||||
|
|
||||||
def test01_parameters():
|
def test01_parameters():
|
||||||
"""One concrete mesh and two steelbar meshes"""
|
"""One concrete mesh and two steelbar meshes"""
|
||||||
datadir = os.path.join(spadder.getTestPadderDataDir(),"test01")
|
datadir = os.path.join(PADDERTESTDIR,"test01")
|
||||||
meshJobParameterList = []
|
meshJobParameterList = []
|
||||||
|
|
||||||
medfile = os.path.join(datadir,"concrete.med")
|
medfile = os.path.join(datadir,"concrete.med")
|
||||||
@ -115,7 +125,7 @@ def test01_parameters():
|
|||||||
|
|
||||||
def test02_parameters():
|
def test02_parameters():
|
||||||
"""One steelbar mesh only, without a concrete mesh"""
|
"""One steelbar mesh only, without a concrete mesh"""
|
||||||
datadir = os.path.join(spadder.getTestPadderDataDir(),"test02")
|
datadir = os.path.join(PADDERTESTDIR,"test02")
|
||||||
meshJobParameterList = []
|
meshJobParameterList = []
|
||||||
|
|
||||||
medfile = os.path.join(datadir,"cadreef.med")
|
medfile = os.path.join(datadir,"cadreef.med")
|
||||||
@ -127,7 +137,7 @@ def test02_parameters():
|
|||||||
|
|
||||||
def test03_parameters():
|
def test03_parameters():
|
||||||
"""One concrete mesh only, without a steelbar mesh"""
|
"""One concrete mesh only, without a steelbar mesh"""
|
||||||
datadir = os.path.join(spadder.getTestPadderDataDir(),"test03")
|
datadir = os.path.join(PADDERTESTDIR,"test03")
|
||||||
meshJobParameterList = []
|
meshJobParameterList = []
|
||||||
|
|
||||||
medfile = os.path.join(datadir,"concrete.med")
|
medfile = os.path.join(datadir,"concrete.med")
|
||||||
@ -209,4 +219,6 @@ 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)
|
meshJobResults = component.finalize(jobid)
|
||||||
print meshJobResults
|
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