add CEXE option to component catalog to be able to specify a specific container
executable for special component
some debug in python container
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 */
} ;
/*!
//
#include "SALOME_ContainerManager.hxx"
#include "SALOME_NamingService.hxx"
+#include "SALOME_ModuleCatalog.hh"
#include "OpUtil.hxx"
#include <sys/types.h>
#include <sys/stat.h>
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);
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();
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;i<componentList.length();i++)
+ {
+ const char* compoi = componentList[i];
+ SALOME_ModuleCatalog::Acomponent_var compoInfo = Catalog->GetComponent(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
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;
command += " SALOME_MPIContainer ";
}
else
- command += " SALOME_Container ";
+ command += " " +container_exe+ " ";
command += _NS->ContainerName(params);
command += " -id ";
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;
if (isPythonContainer(params.container_name))
command += "SALOME_ContainerPy.py ";
else
- command += "SALOME_Container ";
+ command += container_exe + " ";
}
command += _NS->ContainerName(params);
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,
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);
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
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()
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;
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"));
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;
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 {
//! 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();
_aModule.constraint = "";
_aModule.icon="";
_aModule.interfaces.resize(0);
+ _aModule.implementationType ="";
+ _aModule.implementationName ="";
xmlNodePtr aComponentSubNode = aComponentNode->xmlChildrenNode;
while(aComponentSubNode != NULL)
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