The dlerror output for dlopen plus the traceback for the import of the python module
The import_component python function now returns a string instead of a boolean.
If the string is empty, the import is OK.
The C++ code in container MPIContainer and ParallelContainer has been adapted.
//=============================================================================
Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
bool notif,
bool regist ) :
_instanceName(instanceName),
#endif
{
if ( _Sleeping )
- {
- return false ;
- }
+ {
+ return false ;
+ }
else
{
#ifndef WIN32
- RetVal = Killer( _ThreadId ,SIGINT ) ;
+ RetVal = Killer( _ThreadId ,SIGINT ) ;
#else
- RetVal = Killer( *_ThreadId ,SIGINT ) ;
+ RetVal = Killer( *_ThreadId ,SIGINT ) ;
#endif
- //if ( RetVal ) _Sleeping = true;
+ //if ( RetVal ) _Sleeping = true;
}
}
{
if ( _Sleeping )
{
- _Sleeping = false ;
- RetVal = true ;
+ _Sleeping = false ;
+ RetVal = true ;
}
else
{
- RetVal = false ;
+ RetVal = false ;
}
}
return RetVal ;
#else
if ( pthread_self().p != _ThreadId->p )
#endif
- {
+ {
if ( _Sleeping )
- {
- }
+ {
+ }
else
- {
- // Get Cpu in the appropriate thread with that object !...
- theEngines_Component = this ;
+ {
+ // Get Cpu in the appropriate thread with that object !...
+ theEngines_Component = this ;
#ifndef WIN32
- Killer( _ThreadId ,SIGUSR1 ) ;
+ Killer( _ThreadId ,SIGUSR1 ) ;
#else
- Killer( *_ThreadId ,SIGUSR11 ) ;
+ Killer( *_ThreadId ,SIGUSR11 ) ;
#endif
- }
+ }
cpu = _ThreadCpuUsed ;
- }
+ }
else
- {
- _ThreadCpuUsed = CpuUsed() ;
- cpu = _ThreadCpuUsed ;
- // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
- // << _serviceName << " " << cpu << endl ;
+ {
+ _ThreadCpuUsed = CpuUsed() ;
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu << endl ;
}
}
else
{
- cpu = _ThreadCpuUsed ;
- // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
- // << _serviceName << " " << cpu<< endl ;
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu<< endl ;
}
}
else
{
#ifndef WIN32
MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
- << endl << "Component instance : " << _instanceName << endl << endl);
+ << endl << "Component instance : " << _instanceName << endl << endl);
#else
MESSAGE(pthread_self().p << "Send BeginService notification for " <<serviceName
- << endl << "Component instance : " << _instanceName << endl << endl);
+ << endl << "Component instance : " << _instanceName << endl << endl);
#endif
#ifndef WIN32
_ThreadId = pthread_self() ;
{
std::string cle((*it).first);
if ((*it).second.type()->kind() == CORBA::tk_string)
- {
- const char* value;
- (*it).second >>= value;
- // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC.
+ {
+ const char* value;
+ (*it).second >>= value;
+ // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC.
#if defined __GNUC__
-// int ret = setenv(cle.c_str(), value, overwrite);
- setenv(cle.c_str(), value, overwrite);
+// int ret = setenv(cle.c_str(), value, overwrite);
+ setenv(cle.c_str(), value, overwrite);
#else
- //CCRT porting : setenv not defined in stdlib.h
- std::string s(cle);
- s+='=';
- s+=value;
- // char* cast because 1st arg of linux putenv function
- // is not a const char* !
-// int ret=putenv((char *)s.c_str());
- putenv((char *)s.c_str());
- //End of CCRT porting
+ //CCRT porting : setenv not defined in stdlib.h
+ std::string s(cle);
+ s+='=';
+ s+=value;
+ // char* cast because 1st arg of linux putenv function
+ // is not a const char* !
+// int ret=putenv((char *)s.c_str());
+ putenv((char *)s.c_str());
+ //End of CCRT porting
#endif
- MESSAGE("--- setenv: "<<cle<<" = "<< value);
- }
+ MESSAGE("--- setenv: "<<cle<<" = "<< value);
+ }
}
}
#ifndef WIN32
MESSAGE(pthread_self() << " Send EndService notification for " << serviceName
- << endl << " Component instance : " << _instanceName << " StartUsed "
+ << endl << " Component instance : " << _instanceName << " StartUsed "
<< _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
#else
MESSAGE(pthread_self().p << " Send EndService notification for " << serviceName
- << endl << " Component instance : " << _instanceName << " StartUsed "
+ << endl << " Component instance : " << _instanceName << " StartUsed "
<< _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
#endif
_ThreadId = 0 ;
#endif
{
if ( signum == 0 )
- {
- if ( pthread_cancel( ThreadId ) )
- {
- perror("Killer pthread_cancel error") ;
- return false ;
- }
- else
- {
+ {
+ if ( pthread_cancel( ThreadId ) )
+ {
+ perror("Killer pthread_cancel error") ;
+ return false ;
+ }
+ else
+ {
#ifndef WIN32
- MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
- << " pthread_canceled") ;
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
+ << " pthread_canceled") ;
#else
MESSAGE(pthread_self().p << "Killer : ThreadId " << ThreadId.p
- << " pthread_canceled") ;
+ << " pthread_canceled") ;
#endif
- }
- }
+ }
+ }
else
- {
- if ( pthread_kill( ThreadId , signum ) == -1 )
- {
- perror("Killer pthread_kill error") ;
- return false ;
- }
- else
- {
+ {
+ if ( pthread_kill( ThreadId , signum ) == -1 )
+ {
+ perror("Killer pthread_kill error") ;
+ return false ;
+ }
+ else
+ {
#ifndef WIN32
MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
- << " pthread_killed(" << signum << ")") ;
+ << " pthread_killed(" << signum << ")") ;
#else
MESSAGE(pthread_self().p << "Killer : ThreadId " << ThreadId.p
- << " pthread_killed(" << signum << ")") ;
+ << " pthread_killed(" << signum << ")") ;
#endif
- }
- }
+ }
+ }
}
return true ;
}
if ( _ThreadId || _Executed )
{
if ( getrusage( RUSAGE_SELF , &usage ) == -1 )
- {
- perror("Engines_Component_i::CpuUsed") ;
- return 0 ;
- }
+ {
+ perror("Engines_Component_i::CpuUsed") ;
+ return 0 ;
+ }
cpu = usage.ru_utime.tv_sec - _StartUsed ;
// cout << pthread_self() << " Engines_Component_i::CpuUsed " << " "
// << _serviceName << usage.ru_utime.tv_sec << " - " << _StartUsed
// << _StartUsed << endl ;
}
#else
- // NOT implementet yet
+ // NOT implementet yet
#endif
//=============================================================================
void Engines_Component_i::sendMessage(const char *event_type,
- const char *message)
+ const char *message)
{
_notifSupplier->Send(_graphName.c_str(), _nodeName.c_str(), event_type, message);
}
//=============================================================================
Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
- CORBA::Boolean& isValidScript)
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript)
{
const char* aScript = "def RebuildData(theStudy): pass";
char* aBuffer = new char[strlen(aScript)+1];
Engines::Salome_file_ptr
Engines_Component_i::getInputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we throw an exception.
_Service_file_map_it = _Input_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::setInputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we add it.
_Service_file_map_it = _Input_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::getOutputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we throw an exception.
_Service_file_map_it = _Output_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::setOutputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we add it.
_Service_file_map_it = _Output_Service_file_map.find(service_name);
//=============================================================================
void
Engines_Component_i::configureSalome_file(std::string service_name,
- std::string file_port_name,
- Salome_file_i * file)
+ std::string file_port_name,
+ Salome_file_i * file)
{
// By default this method does nothing
}
map<std::string, void *> Engines_Container_i::_toRemove_map;
omni_mutex Engines_Container_i::_numInstanceMutex ;
+int checkifexecutable(const std::string&);
+int findpathof(std::string&, const std::string&);
+
/*! \class Engines_Container_i
* \brief C++ implementation of Engines::Container interface
*
{
string path( getenv("PATH") );
if ( path.size() == 0 )
- return 0;
-
+ return 0;
+
char path_spr =
#ifdef WIN32
';';
return true;
}
+ std::string retso="";
#ifndef WIN32
void* handle;
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+ if ( !handle )retso=dlerror();
#else
HINSTANCE handle;
handle = LoadLibrary( impl_name.c_str() );
// --- try import Python component
INFOS("try import Python component "<<componentName);
+ std::string retpy;
if (_isSupervContainer)
{
INFOS("Supervision Container does not support Python Component Engines");
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret= PyInt_AsLong(result);
+
+ retpy=PyString_AsString(result);
Py_XDECREF(result);
- SCRUTE(ret);
+ SCRUTE(retpy);
Py_RELEASE_NEW_THREAD;
- if (ret) // import possible: Python component
+ if (retpy=="") // import possible: Python component
{
_numInstanceMutex.lock() ; // lock to be alone (stl container write)
_library_map[aCompName] = (void *)pyCont; // any non O value OK
INFOS( "Impossible to load component: " << componentName );
INFOS( "Can't load shared library: " << impl_name );
+ std::cerr << retso << std::endl;
INFOS( "Can't import Python module: " << componentName );
+ std::cerr << retpy << std::endl;
INFOS( "Can't execute program: " << executable );
return false;
}
def DumpPython(self, theStudy, isPublished):
aBuffer = "def RebuildData(theStudy): pass\n\0"
- return (aBuffer, 1)
+ return (aBuffer, 1)
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
def hasObjectInfo(self):
- return 0
+ return 0
#-------------------------------------------------------------------------
public:
Engines_Component_i();
Engines_Component_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
bool notif = false,
bool regist = true);
//Constructor for standalone component
Engines_Component_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- Engines::Container_ptr container,
- const char *instanceName,
- const char *interfaceName,
+ PortableServer::POA_ptr poa,
+ Engines::Container_ptr container,
+ const char *instanceName,
+ const char *interfaceName,
bool notif = false,
bool regist = true);
if (!isSupervContainer)
{
PyGILState_Ensure();
- //Delete python container that destroy orb from python (pyCont._orb.destroy())
+ //Destroy orb from python (for chasing memory leaks)
+ //PyRun_SimpleString("from omniORB import CORBA");
+ //PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)");
+ //PyRun_SimpleString("orb.destroy()");
Py_Finalize();
}
else
#endif
#endif
- //END_OF(argv[0]);
- //LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
- //bp1->deleteInstance(bp1);
return 0 ;
}
#=============================================================================
-#define an implementation of the container interface
+#define an implementation of the container interface for embedding in Container implemented in C++
class SALOME_Container_i:
_orb = None
#-------------------------------------------------------------------------
- #def __del__(self ):
- # self._orb.destroy()
-
def import_component(self, componentName):
MESSAGE( "SALOME_Container_i::import_component" )
- ret=0
+ ret=""
try:
if verbose(): print "try import ",componentName
__import__(componentName)
if verbose(): print "import ",componentName," successful"
- ret=1
except:
+ import traceback
+ ret=traceback.format_exc(10)
if verbose():
- import traceback
traceback.print_exc()
print "import ",componentName," not possible"
return ret
{
try
{
- SCRUTE((*iter));
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont))
- {
- MESSAGE("ShutdownContainers: " << (*iter));
- cont->Shutdown();
- }
- else
- MESSAGE("ShutdownContainers: no container ref for " << (*iter));
+ SCRUTE((*iter));
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont))
+ {
+ MESSAGE("ShutdownContainers: " << (*iter));
+ cont->Shutdown();
+ }
+ else
+ MESSAGE("ShutdownContainers: no container ref for " << (*iter));
}
catch(CORBA::SystemException& e)
{
- INFOS("CORBA::SystemException ignored : " << e);
+ INFOS("CORBA::SystemException ignored : " << e);
}
catch(CORBA::Exception&)
{
- INFOS("CORBA::Exception ignored.");
+ INFOS("CORBA::Exception ignored.");
}
catch(...)
{
- INFOS("Unknown exception ignored.");
+ INFOS("Unknown exception ignored.");
}
}
}
// Il faut tuer le proxy
try
{
- Engines::Container_var proxy = Engines::Container::_narrow(container_proxy);
- proxy->Shutdown();
+ Engines::Container_var proxy = Engines::Container::_narrow(container_proxy);
+ proxy->Shutdown();
}
catch (...)
{
- INFOS("[StartParallelContainer] Exception catched from proxy Shutdown...");
+ INFOS("[StartParallelContainer] Exception catched from proxy Shutdown...");
}
return ret;
}
obj = _NS->Resolve(containerNameInNS.c_str());
if (CORBA::is_nil(obj))
{
- INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !");
- INFOS("[StartParallelContainer] Container name is " << containerNameInNS);
- return ret;
+ INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !");
+ INFOS("[StartParallelContainer] Container name is " << containerNameInNS);
+ return ret;
}
try
{
- MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name);
- PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
- node->deploy();
- MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed");
+ MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name);
+ PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
+ node->deploy();
+ MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed");
}
catch(CORBA::SystemException& e)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("CORBA::SystemException : " << e);
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("CORBA::SystemException : " << e);
+ return ret;
}
catch(CORBA::Exception& e)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("CORBA::Exception" << e);
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("CORBA::Exception" << e);
+ return ret;
}
catch(...)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("Unknown exception !");
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("Unknown exception !");
+ return ret;
}
}
//=============================================================================
CORBA::Object_ptr
SALOME_ContainerManager::LaunchParallelContainer(const std::string& command,
- const Engines::MachineParameters& params,
- const std::string& name,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
+ const Engines::MachineParameters& params,
+ const std::string& name,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
{
CORBA::Object_ptr obj = CORBA::Object::_nil();
std::string containerNameInNS;
INFOS("[LaunchParallelContainer] Waiting for Parallel Container node " << containerNameInNS << " on " << theMachine);
while (CORBA::is_nil(obj) && count) {
#ifndef WIN32
- sleep(1) ;
+ sleep(1) ;
#else
- Sleep(1000);
+ Sleep(1000);
#endif
- count-- ;
- obj = _NS->Resolve(containerNameInNS.c_str());
+ count-- ;
+ obj = _NS->Resolve(containerNameInNS.c_str());
}
if (CORBA::is_nil(obj))
{
- INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !");
- return obj;
+ INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !");
+ return obj;
}
}
}
{
string command;
int nbproc;
-
+
if ( ! _isAppliSalomeDefined )
command = BuildTempFileToLaunchRemoteContainer(machine, params);
throw SALOME_Exception("Unknown protocol");
if (resInfo.UserName != "")
- {
- command += resInfo.UserName;
- command += "@";
- }
+ {
+ command += resInfo.UserName;
+ command += "@";
+ }
command += machine;
command += " ";
if (resInfo.AppliPath != "")
- command += resInfo.AppliPath; // path relative to user@machine $HOME
+ command += resInfo.AppliPath; // path relative to user@machine $HOME
else
- {
- ASSERT(getenv("APPLI"));
- command += getenv("APPLI"); // path relative to user@machine $HOME
- }
+ {
+ ASSERT(getenv("APPLI"));
+ command += getenv("APPLI"); // path relative to user@machine $HOME
+ }
command += "/runRemote.sh ";
}
if(params.isMPI)
- {
- command += " mpirun -np ";
- std::ostringstream o;
- o << nbproc << " ";
- command += o.str();
+ {
+ command += " mpirun -np ";
+ std::ostringstream o;
+ o << nbproc << " ";
+ command += o.str();
#ifdef WITHLAM
- command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
+ command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
#elif defined(WITHOPENMPI)
- if( getenv("OMPI_URI_FILE") == NULL )
- command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
- else{
- command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- command += getenv("OMPI_URI_FILE");
- }
-#endif
- command += " SALOME_MPIContainer ";
- }
+ if( getenv("OMPI_URI_FILE") == NULL )
+ command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ else{
+ command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
+ command += getenv("OMPI_URI_FILE");
+ }
+#endif
+ command += " SALOME_MPIContainer ";
+ }
else
command += " " +container_exe+ " ";
#elif defined(WITHOPENMPI)
//command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace ";
if( getenv("OMPI_URI_FILE") == NULL )
- command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
else
{
command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
tempOutputFile << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
#elif defined(WITHOPENMPI)
if( getenv("OMPI_URI_FILE") == NULL )
- tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
else{
- tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- tempOutputFile << getenv("OMPI_URI_FILE");
+ tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
+ tempOutputFile << getenv("OMPI_URI_FILE");
}
#endif
}
//=============================================================================
string
SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string& exe_name,
- const Engines::MachineParameters& params,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
- const std::string proxy_hostname)
+ const Engines::MachineParameters& params,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
+ const std::string proxy_hostname)
{
// This method knows the differences between the proxy and the nodes.
// nb_component_nodes is not used in the same way if it is a proxy or
if (is_a_proxy)
{
machine_file_name = _ResManager->getMachineFile(hostname,
- 1,
- parallelLib);
+ 1,
+ parallelLib);
}
else
{
machine_file_name = _ResManager->getMachineFile(hostname,
- params.nb_component_nodes,
- parallelLib);
+ params.nb_component_nodes,
+ parallelLib);
}
if (machine_file_name == "")
{
std::string command_remote("");
if (remote)
{
- std::string machine_name;
- std::ifstream machine_file(machine_file_name.c_str());
- std::getline(machine_file, machine_name);
- MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
-
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += machine_name;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = machine_name;
+ std::string machine_name;
+ std::ifstream machine_file(machine_file_name.c_str());
+ std::getline(machine_file, machine_name);
+ MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
+
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += machine_name;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = machine_name;
}
command = real_exe_name;
{
std::ifstream * machine_file = NULL;
if (remote)
- machine_file = new std::ifstream(machine_file_name.c_str());
+ machine_file = new std::ifstream(machine_file_name.c_str());
for (int i= 0; i < nb_nodes; i++)
{
- std::string command_remote("");
- if (remote)
- {
- std::string machine_name;
- std::getline(*machine_file, machine_name);
- MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
-
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += machine_name;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = machine_name;
- }
-
- std::ostringstream tmp;
- tmp << i;
- std::string proc_number = tmp.str();
-
- std::string command_tmp("");
- command_tmp += real_exe_name;
- command_tmp += " " + _NS->ContainerName(rtn);
- command_tmp += " " + parallelLib;
- command_tmp += " " + proxy_hostname;
- command_tmp += " " + proc_number;
- command_tmp += " -";
- AddOmninamesParams(command_tmp);
-
- // On change _Node_ par _Nodex_ pour avoir chaque noeud
- // sur un fichier
- std::string command_end_tmp = command_end;
- std::string::size_type loc_node = command_end_tmp.find("_Node_");
- if (loc_node != std::string::npos)
- command_end_tmp.insert(loc_node+5, proc_number);
- command += command_begin + command_remote + command_tmp + command_end_tmp;
- vect_machine.push_back(hostname);
+ std::string command_remote("");
+ if (remote)
+ {
+ std::string machine_name;
+ std::getline(*machine_file, machine_name);
+ MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
+
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += machine_name;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = machine_name;
+ }
+
+ std::ostringstream tmp;
+ tmp << i;
+ std::string proc_number = tmp.str();
+
+ std::string command_tmp("");
+ command_tmp += real_exe_name;
+ command_tmp += " " + _NS->ContainerName(rtn);
+ command_tmp += " " + parallelLib;
+ command_tmp += " " + proxy_hostname;
+ command_tmp += " " + proc_number;
+ command_tmp += " -";
+ AddOmninamesParams(command_tmp);
+
+ // On change _Node_ par _Nodex_ pour avoir chaque noeud
+ // sur un fichier
+ std::string command_end_tmp = command_end;
+ std::string::size_type loc_node = command_end_tmp.find("_Node_");
+ if (loc_node != std::string::npos)
+ command_end_tmp.insert(loc_node+5, proc_number);
+ command += command_begin + command_remote + command_tmp + command_end_tmp;
+ vect_machine.push_back(hostname);
}
if (machine_file)
- delete machine_file;
+ delete machine_file;
}
}
else if (parallelLib == "Mpi")
std::string command_remote("");
const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
if (resInfo.Protocol == rsh)
- command_remote = "rcp ";
+ command_remote = "rcp ";
else
- command_remote = "scp ";
+ command_remote = "scp ";
command_remote += machine_file_name;
command_remote += " ";
int status = system(command_remote.c_str());
if (status == -1)
{
- INFOS("copy of the mpi machine file failed !");
- return "";
+ INFOS("copy of the mpi machine file failed !");
+ return "";
}
}
std::string command_remote("");
if (remote)
{
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += remote_machine;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = remote_machine;
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += remote_machine;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = remote_machine;
}
// We use Dummy proxy for MPI parallel containers
std::string command_remote("");
if (remote)
{
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += remote_machine;
- command_remote += " ";
-
- std::string new_real_exe_name("");
- new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME
- new_real_exe_name += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server
- new_real_exe_name += " ";
- ASSERT(getenv("NSPORT"));
- new_real_exe_name += getenv("NSPORT"); // port of CORBA name server
- new_real_exe_name += " ";
-
- real_exe_name = new_real_exe_name + real_exe_name;
- hostname = remote_machine;
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += remote_machine;
+ command_remote += " ";
+
+ std::string new_real_exe_name("");
+ new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME
+ new_real_exe_name += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server
+ new_real_exe_name += " ";
+ ASSERT(getenv("NSPORT"));
+ new_real_exe_name += getenv("NSPORT"); // port of CORBA name server
+ new_real_exe_name += " ";
+
+ real_exe_name = new_real_exe_name + real_exe_name;
+ hostname = remote_machine;
}
const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(hostname);
if (resInfo.mpi == lam)
{
- command = "mpiexec -ssi boot ";
- if (resInfo.Protocol == rsh)
- command += "rsh ";
- else
- command += "ssh ";
- command += "-machinefile " + machine_file_name + " ";
- command += "-n " + nbproc + " ";
- command += real_exe_name;
- command += " " + _NS->ContainerName(rtn);
- command += " " + parallelLib;
- command += " " + proxy_hostname;
- command += " -";
- AddOmninamesParams(command);
+ command = "mpiexec -ssi boot ";
+ if (resInfo.Protocol == rsh)
+ command += "rsh ";
+ else
+ command += "ssh ";
+ command += "-machinefile " + machine_file_name + " ";
+ command += "-n " + nbproc + " ";
+ command += real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + parallelLib;
+ command += " " + proxy_hostname;
+ command += " -";
+ AddOmninamesParams(command);
}
else
{
- command = "mpirun -np " + nbproc + " ";
- command += real_exe_name;
- command += " " + _NS->ContainerName(rtn);
- command += " " + parallelLib;
- command += " " + proxy_hostname;
- command += " -";
- AddOmninamesParams(command);
+ command = "mpirun -np " + nbproc + " ";
+ command += real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + parallelLib;
+ command += " " + proxy_hostname;
+ command += " -";
+ AddOmninamesParams(command);
}
command = command_begin + command_remote + command + command_end;
for (int i= 0; i < nb_nodes; i++)
- vect_machine.push_back(proxy_hostname);
+ vect_machine.push_back(proxy_hostname);
}
}
else
void fillBatchLaunchedContainers();
std::string BuildCommandToLaunchRemoteContainer(const std::string& machine,
- const Engines::MachineParameters& params,
- const std::string& container_exe="SALOME_Container");
+ const Engines::MachineParameters& params,
+ const std::string& container_exe="SALOME_Container");
std::string BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params,
const std::string& container_exe="SALOME_Container");
std::string BuildTempFileToLaunchRemoteContainer(const std::string& machine,
- const Engines::MachineParameters& params) throw(SALOME_Exception);
+ const Engines::MachineParameters& params) throw(SALOME_Exception);
void RmTmpFile(std::string& tmpFile);
// For PacO++ Parallel extension
typedef std::vector<std::string> actual_launch_machine_t;
std::string BuildCommandToLaunchParallelContainer(const std::string& exe_name,
- const Engines::MachineParameters& params,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
- const std::string proxy_hostname = "");
+ const Engines::MachineParameters& params,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
+ const std::string proxy_hostname = "");
CORBA::Object_ptr
LaunchParallelContainer(const std::string& command,
- const Engines::MachineParameters& params,
- const std::string& name,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine);
+ const Engines::MachineParameters& params,
+ const std::string& name,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine);
CORBA::ORB_var _orb;
PortableServer::POA_var _poa;
#=============================================================================
-#define an implementation of the container interface
+#define an implementation of the container interface for the container implemented in Python
class SALOME_ContainerPy_i (Engines__POA.Container):
_orb = None
self._poa = poa
myMachine=getShortHostName()
Container_path = "/Containers/" + myMachine + "/" + containerName
- #self._containerName = containerName
self._containerName = Container_path
if verbose(): print "container name ",self._containerName
if verbose(): print "import ",componentName," successful"
ret=1
except:
- if verbose():
- import traceback
- traceback.print_exc()
- print "import ",componentName," not possible"
+ import traceback
+ traceback.print_exc()
+ print "import ",componentName," not possible"
return ret
#-------------------------------------------------------------------------
ret = 0
instanceName = componentName + "_inst_" + `self._numInstance`
interfaceName = componentName
- #the_command = "import " + componentName + "\n"
- #the_command = the_command + "comp_i = " + componentName + "." + componentName
- #the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n"
- #MESSAGE( "SALOME_ContainerPy_i::load_component_Library :" + str (the_command) )
- #exec the_command
- #comp_o = comp_i._this()
- #if comp_o is not None:
- # ret = 1
- #else:
- # --- try to import Python component
- # retImpl = self.import_component(componentName)
- # if retImpl == 1:
- #import is possible
- # ret = 1
- # else:
- #import isn't possible
- # ret = 0
- #return ret
return self.import_component(componentName)
#-------------------------------------------------------------------------
public:
Engines_Container_i();
Engines_Container_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- char * containerName ,
+ PortableServer::POA_ptr poa,
+ char * containerName ,
int argc, char* argv[],
- bool activAndRegist = true,
- bool isServantAloneInProcess = true);
+ bool activAndRegist = true,
+ bool isServantAloneInProcess = true);
virtual ~Engines_Container_i();
// --- CORBA methods
virtual Engines::Component_ptr
create_component_instance( const char* componentName,
- CORBA::Long studyId); // 0 for multiStudy
+ CORBA::Long studyId); // 0 for multiStudy
Engines::Component_ptr
find_component_instance( const char* registeredName,
- CORBA::Long studyId); // 0 for multiStudy
+ CORBA::Long studyId); // 0 for multiStudy
Engines::Component_ptr
load_impl(const char* nameToRegister,
- const char* componentName);
+ const char* componentName);
void remove_impl(Engines::Component_ptr component_i);
Engines::Component_ptr
find_or_create_instance( std::string genericRegisterName,
- std::string componentLibraryName);
+ std::string componentLibraryName);
Engines::Component_ptr
createInstance(std::string genericRegisterName,
- void *handle,
- int studyId);
+ void *handle,
+ int studyId);
static bool isPythonContainer(const char* ContainerName);
static void decInstanceCnt(std::string genericRegisterName);
//=============================================================================
fileRef_i::fileRef_i(Engines::Container_ptr container,
- const char* origFileName)
+ const char* origFileName)
{
MESSAGE("fileRef_i::fileRef_i "<< origFileName);
_container = Engines::Container::_duplicate(container);
//=============================================================================
CORBA::Boolean fileRef_i::addRef(const char* machine,
- const char* fileName)
+ const char* fileName)
{
MESSAGE("fileRef_i::addRef " << machine << " " << fileName);
string theMachine = machine;
if (! _copies[theMachine].empty())
{
INFOS("there is already a copy on " << theMachine << " under the path "
- << _copies[theMachine] << " new ref not added! ");
+ << _copies[theMachine] << " new ref not added! ");
return 0;
}
if (_copies[theMachine].empty())
{
MESSAGE("no copy of " << _machine << _origFileName << " available on "
- << theMachine);
+ << theMachine);
}
else
{
MESSAGE("a copy of " << _machine << _origFileName << "is available on "
- << theMachine << _copies[theMachine]);
+ << theMachine << _copies[theMachine]);
}
return CORBA::string_dup(_copies[theMachine].c_str());
}
public:
fileRef_i();
fileRef_i(Engines::Container_ptr container,
- const char* origFileName);
+ const char* origFileName);
virtual ~fileRef_i();
char* origFileName();
Engines::Container_ptr getContainer();
CORBA::Boolean addRef(const char* machine,
- const char* fileName);
+ const char* fileName);
char* getRef(const char* machine);
if (mode == "all") {
- // Changing path, is now current directory
- path = getcwd(NULL, _path_max);
+ // Changing path, is now current directory
+ path = getcwd(NULL, _path_max);
- std::string group_name("GROUP");
- group_name += file_name;
- hdf_group = new HDFgroup(group_name.c_str(),hdf_file);
- hdf_group->OpenOnDisk();
- hdf_dataset = new HDFdataset("FILE DATASET",hdf_group);
- hdf_dataset->OpenOnDisk();
- size = hdf_dataset->GetSize();
- buffer = new char[size];
+ std::string group_name("GROUP");
+ group_name += file_name;
+ hdf_group = new HDFgroup(group_name.c_str(),hdf_file);
+ hdf_group->OpenOnDisk();
+ hdf_dataset = new HDFdataset("FILE DATASET",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ buffer = new char[size];
- if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) {
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- std::string text = "open failed";
- es.text = CORBA::string_dup(text.c_str());
- throw SALOME::SALOME_Exception(es);
- };
- hdf_dataset->ReadFromDisk(buffer);
- if ( write(fd,buffer,size) <0) {
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- std::string text = "write failed";
- es.text = CORBA::string_dup(text.c_str());
- throw SALOME::SALOME_Exception(es);
- };
- // Close the target file
- ::close(fd);
-
- Engines::file infos;
- infos.file_name = CORBA::string_dup(file_name.c_str());
- infos.path = CORBA::string_dup(path.c_str());
- infos.type = CORBA::string_dup(type.c_str());
- infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
- infos.status = CORBA::string_dup(status.c_str());
-
- _fileManaged[file_name] = infos;
-
- // Update Salome_file state
- _state.number_of_files++;
- _state.files_ok = true;
+ if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "open failed";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ };
+ hdf_dataset->ReadFromDisk(buffer);
+ if ( write(fd,buffer,size) <0) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "write failed";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ };
+ // Close the target file
+ ::close(fd);
+
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ _state.files_ok = true;
}
else {
- Engines::file infos;
- infos.file_name = CORBA::string_dup(file_name.c_str());
- infos.path = CORBA::string_dup(path.c_str());
- infos.type = CORBA::string_dup(type.c_str());
- infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
- infos.status = CORBA::string_dup(status.c_str());
- // Infos for parallel extensions...
- infos.node = 0;
- infos.container = Engines::Container::_duplicate(_container);
-
- _fileManaged[file_name] = infos;
-
- // Update Salome_file state
- _state.number_of_files++;
- if (status != "ok")
- _state.files_ok = false;
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+ // Infos for parallel extensions...
+ infos.node = 0;
+ infos.container = Engines::Container::_duplicate(_container);
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ if (status != "ok")
+ _state.files_ok = false;
}
}
}
_t_fileDistributedSource::iterator it = _fileDistributedSource.find(file_name);
if (it == _fileDistributedSource.end())
{
- _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file);
+ _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file);
}
}
}
//=============================================================================
void
Salome_file_i::connectDistributedFile(const char * file_name,
- Engines::Salome_file_ptr source_Salome_file)
+ Engines::Salome_file_ptr source_Salome_file)
{
// Test if this file is added
_t_fileManaged::iterator it = _fileManaged.find(file_name);
//=============================================================================
void
Salome_file_i::setDistributedSourceFile(const char* file_name,
- const char * source_file_name)
+ const char * source_file_name)
{
std::string fname(file_name);
if (std::string(file_infos.type.in()) == "local")
{
if (std::string(file_infos.status.in()) == "not_ok")
- result = checkLocalFile(file_infos.file_name.in());
+ result = checkLocalFile(file_infos.file_name.in());
}
else
{
if (std::string(file_infos.status.in()) == "not_ok")
- result = getDistributedFile(file_infos.file_name.in());
+ result = getDistributedFile(file_infos.file_name.in());
}
// if the result is false
// we add this file to files_not_ok
// Configure DistributedFile
virtual void connect(Engines::Salome_file_ptr source_Salome_file);
virtual void connectDistributedFile(const char * file_name,
- Engines::Salome_file_ptr source_Salome_file);
+ Engines::Salome_file_ptr source_Salome_file);
virtual void setDistributedSourceFile(const char* file_name,
- const char * source_file_name);
+ const char * source_file_name);
// Recv and check files
virtual void recvFiles();
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret= PyInt_AsLong(result);
+ std::string ret= PyString_AsString(result);
SCRUTE(ret);
Py_RELEASE_NEW_THREAD;
- if (ret) // import possible: Python component
+ if (ret=="") // import possible: Python component
{
_library_map[aCompName] = (void *)pyCont; // any non O value OK
MESSAGE("[" << _numproc << "] import Python: "<<aCompName<<" OK");
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret_p= PyInt_AsLong(result);
+ std::string ret_p= PyString_AsString(result);
Py_XDECREF(result);
Py_RELEASE_NEW_THREAD;
- if (ret_p) // import possible: Python component
+ if (ret_p=="") // import possible: Python component
{
MESSAGE("import Python: " << aCompName <<" OK");
}
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret_p= PyInt_AsLong(result);
+ std::string ret_p= PyString_AsString(result);
Py_XDECREF(result);
Py_RELEASE_NEW_THREAD;
- if (ret_p) // import possible: Python component
+ if (ret_p=="") // import possible: Python component
{
_library_map[aCompName] = (void *)pyCont; // any non O value OK
MESSAGE("import Python: " << aCompName <<" OK");