From: caremoli Date: Fri, 30 May 2008 09:02:44 +0000 (+0000) Subject: CCAR: add traces to CALCIUM ports, some debug in ModuleCatalog X-Git-Tag: CCARexeccompoStart~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e73a7e4ed177fed6013c7cf416e2e465f2cfc0b6;p=modules%2Fkernel.git CCAR: add traces to CALCIUM ports, some debug in ModuleCatalog add CEXE option to component catalog to be able to specify a specific container executable for special component some debug in python container --- diff --git a/idl/SALOME_ModuleCatalog.idl b/idl/SALOME_ModuleCatalog.idl index dfc8764f6..9231f7e39 100644 --- a/idl/SALOME_ModuleCatalog.idl +++ b/idl/SALOME_ModuleCatalog.idl @@ -171,7 +171,8 @@ Implementation type enum ImplType { SO, /* component implemented as a dynamic library loadable with dlopen */ PY, /* component implemented as a python module loadable with import */ - EXE /* component implemented as an executable */ + EXE, /* component implemented as an executable */ + CEXE /* component to be loaded by a container which executable is given in the catalog */ } ; /*! diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 52802a144..20f46f6d7 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -19,6 +19,7 @@ // #include "SALOME_ContainerManager.hxx" #include "SALOME_NamingService.hxx" +#include "SALOME_ModuleCatalog.hh" #include "OpUtil.hxx" #include #include @@ -199,7 +200,7 @@ Engines::Container_ptr SALOME_ContainerManager:: StartContainer(const Engines::MachineParameters& params, const Engines::MachineList& possibleComputers, - Engines::ResPolicy policy) + Engines::ResPolicy policy,const std::string& container_exe) { #ifdef WITH_PACO_PARALLEL std::string parallelLib(params.parallelLib); @@ -259,9 +260,9 @@ StartContainer(const Engines::MachineParameters& params, return Engines::Container::_nil(); } else if(theMachine==GetHostname()) - command = BuildCommandToLaunchLocalContainer(params,id); + command = BuildCommandToLaunchLocalContainer(params,id,container_exe); else - command = BuildCommandToLaunchRemoteContainer(theMachine,params,id); + command = BuildCommandToLaunchRemoteContainer(theMachine,params,id,container_exe); RmTmpFile(); @@ -349,7 +350,55 @@ StartContainer(const Engines::MachineParameters& params, const Engines::CompoList& componentList) { Engines::MachineList_var possibleComputers = _ResManager->GetFittingResources(params,componentList); - return StartContainer(params,possibleComputers,policy); + + // Look into ModulCatalog if a specific container must be launched + CORBA::String_var container_exe; + int found=0; + try + { + CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog"); + SALOME_ModuleCatalog::ModuleCatalog_var Catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ; + if (CORBA::is_nil (Catalog)) + return Engines::Container::_nil(); + // Loop through component list + for(int i=0;iGetComponent(compoi); + if (CORBA::is_nil (compoInfo)) + { + INFOS("ContainerManager Error: Component not found in the catalog" ); + INFOS( compoi ); + return Engines::Container::_nil(); + } + SALOME_ModuleCatalog::ImplType impl=compoInfo->implementation_type(); + container_exe=compoInfo->implementation_name(); + if(impl==SALOME_ModuleCatalog::CEXE) + { + if(found) + { + INFOS("ContainerManager Error: you can't have 2 CEXE component in the same container" ); + return Engines::Container::_nil(); + } + found=1; + } + } + } + catch (ServiceUnreachable&) + { + INFOS("Caught exception: Naming Service Unreachable"); + return Engines::Container::_nil(); + } + catch (...) + { + INFOS("Caught unknown exception."); + return Engines::Container::_nil(); + } + + if(found) + return StartContainer(params,possibleComputers,policy,container_exe.in()); + else + return StartContainer(params,possibleComputers,policy); } #ifdef WITH_PACO_PARALLEL @@ -738,7 +787,7 @@ bool isPythonContainer(const char* ContainerName) string SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer (const string& machine, - const Engines::MachineParameters& params, const long id) + const Engines::MachineParameters& params, const long id,const std::string& container_exe) { string command; int nbproc; @@ -822,7 +871,7 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer command += " SALOME_MPIContainer "; } else - command += " SALOME_Container "; + command += " " +container_exe+ " "; command += _NS->ContainerName(params); command += " -id "; @@ -845,7 +894,7 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer string SALOME_ContainerManager::BuildCommandToLaunchLocalContainer -(const Engines::MachineParameters& params, const long id) +(const Engines::MachineParameters& params, const long id,const std::string& container_exe) { _TmpFileName = ""; string command; @@ -906,7 +955,7 @@ SALOME_ContainerManager::BuildCommandToLaunchLocalContainer if (isPythonContainer(params.container_name)) command += "SALOME_ContainerPy.py "; else - command += "SALOME_Container "; + command += container_exe + " "; } command += _NS->ContainerName(params); diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index d8be68833..869b9c235 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -47,7 +47,8 @@ public: Engines::Container_ptr StartContainer(const Engines::MachineParameters& params, const Engines::MachineList& possibleComputer, - Engines::ResPolicy policy); + Engines::ResPolicy policy, + const std::string& container_exe="SALOME_Container"); Engines::Container_ptr StartContainer(const Engines::MachineParameters& params, @@ -88,9 +89,11 @@ protected: long GetIdForContainer(void); std::string BuildCommandToLaunchRemoteContainer(const std::string& machine, - const Engines::MachineParameters& params, const long id); + const Engines::MachineParameters& params, const long id, + const std::string& container_exe="SALOME_Container"); - std::string BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params, const long id); + std::string BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params, const long id, + const std::string& container_exe="SALOME_Container"); std::string BuildTempFileToLaunchRemoteContainer(const std::string& machine, const Engines::MachineParameters& params) throw(SALOME_Exception); diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index 1694bc79d..db23b6c79 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -307,6 +307,13 @@ class SALOME_ContainerPy_i (Engines__POA.Container): self._orb.shutdown(0) pass + def _get_logfilename(self): + return self._logfilename + def _set_logfilename(self,logfilename): + self._logfilename=logfilename + def _get_workingdir(self): + return os.getcwd() + #============================================================================= #initialise the ORB and find the root POA @@ -323,6 +330,8 @@ cpy_i = SALOME_ContainerPy_i(orb, poa, containerName) print "SALOME_ContainerPy_i instance created ",cpy_i cpy_o = cpy_i._this() print "SALOME_ContainerPy_i instance activated ",cpy_o +sys.stdout.flush() +sys.stderr.flush() #activate the POA poaManager = poa._get_the_POAManager() diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx index 2a18b69e3..6835898f9 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx @@ -38,12 +38,18 @@ void CalciumCouplingPolicy::setDependencyType (CalciumTypes::DependencyType depe CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;} void CalciumCouplingPolicy::setStorageLevel (size_t storageLevel) { +#ifdef _DEBUG_ + std::cerr << "CalciumCouplingPolicy::setStorageLevel: " << storageLevel << std::endl; +#endif if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL) ) throw CalciumException(CalciumTypes::CPRENA,LOC("Un niveau < 1 n'est pas autorisé")); _storageLevel = storageLevel; } size_t CalciumCouplingPolicy::getStorageLevel () const {return _storageLevel;} void CalciumCouplingPolicy::setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) { +#ifdef _DEBUG_ + std::cerr << "CalciumCouplingPolicy::setDateCalSchem: " << dateCalSchem << std::endl; +#endif if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) throw CalciumException(CalciumTypes::CPITVR,LOC("Il est impossible de positionner un schéma temporel sur un port qui n'est pas en dépendance temporelle")); _dateCalSchem = dateCalSchem; @@ -52,6 +58,9 @@ void CalciumCouplingPolicy::setDateCalSchem (CalciumTypes::DateCalSchem da CalciumTypes::DateCalSchem CalciumCouplingPolicy::getDateCalSchem () const { return _dateCalSchem; } void CalciumCouplingPolicy::setAlpha(double alpha) { +#ifdef _DEBUG_ + std::cerr << "CalciumCouplingPolicy::setAlpha: " << alpha << std::endl; +#endif if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) throw CalciumException(CalciumTypes::CPITVR,LOC("Il est impossible de positionner alpha sur un port qui n'est pas en dépendance temporelle")); @@ -72,6 +81,9 @@ void CalciumCouplingPolicy::setDeltaT(double deltaT ) { double CalciumCouplingPolicy::getDeltaT() const {return _deltaT;} void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) { +#ifdef _DEBUG_ + std::cerr << "CalciumCouplingPolicy::setInterpolationSchem: " << interpolationSchem << std::endl; +#endif if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre InterpolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens")); _interpolationSchem=interpolationSchem; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx index 1fe1c0e5b..4ae601ad7 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx @@ -244,6 +244,12 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< Type dataOut = DataManipulator::create(dataSize); InnerType * const OutIt = DataManipulator::getPointer(dataOut); +#ifdef _DEBUG_ + std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : interpolationSchem : " << _couplingPolicy._interpolationSchem << std::endl; + std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : alpha : " << _couplingPolicy._alpha << std::endl; + std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : datecalschem : " << _couplingPolicy._dateCalSchem << std::endl; + std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : storageLevel : " << _couplingPolicy._storageLevel << std::endl; +#endif if ( timeDiff == 0.0 || _couplingPolicy._interpolationSchem == CalciumTypes::L0_SCHEM ) { std::copy(InIt1,InIt1+dataSize,OutIt); } else { diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx index e693d70f4..0c8661430 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx @@ -137,7 +137,7 @@ public: //! method to define if a component is implemented in a dyn lib a python module or an executable /*! - \return an enum SO or PY or EXE + \return an enum SO or PY or EXE or CEXE */ virtual SALOME_ModuleCatalog::ImplType implementation_type(); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index 5fd1ff4e4..88fd5e7bc 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -413,6 +413,8 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _aModule.constraint = ""; _aModule.icon=""; _aModule.interfaces.resize(0); + _aModule.implementationType =""; + _aModule.implementationName =""; xmlNodePtr aComponentSubNode = aComponentNode->xmlChildrenNode; while(aComponentSubNode != NULL) diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index c63e0cdea..87c1f80a9 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -747,6 +747,8 @@ void SALOME_ModuleCatalogImpl::duplicate C_corba.type = ComponentTypeConvert[C_parser.type]; if(C_parser.implementationType == "EXE") C_corba.implementationType=SALOME_ModuleCatalog::EXE; + else if(C_parser.implementationType == "CEXE") + C_corba.implementationType=SALOME_ModuleCatalog::CEXE; else if(C_parser.implementationType == "PY") C_corba.implementationType=SALOME_ModuleCatalog::PY; else