Type to transmit list of machines.
*/
typedef sequence<string> MachineList;
+ typedef sequence<string> CompoList;
/*!
exception thrown if a computer is not found in the catalog
in MachineList possibleComputers);
Container StartContainer( in MachineParameters params,
- in ResPolicy policy);
+ in ResPolicy policy,
+ in CompoList componentList );
string FindFirst(in MachineList possibleComputers);
MachineList GetFittingResources( in MachineParameters params,
- in string componentName )
+ in CompoList componentList )
raises (SALOME::SALOME_Exception);
MachineParameters GetMachineParameters( in string hostname );
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
- -I$(srcdir)/../LifeCycleCORBA \
-I$(srcdir)/../Utils \
-I$(srcdir)/../Registry \
-I$(srcdir)/../Notification \
../Notification/libSalomeNotification.la \
../ResourcesManager/libSalomeResourcesManager.la \
../NamingService/libSalomeNS.la \
- ../LifeCycleCORBA/libSalomeLifeCycleCORBA.la \
../Utils/libOpUtil.la \
../SALOMELocalTrace/libSALOMELocalTrace.la \
../Basics/libSALOMEBasics.la \
# Executables targets
# ===============================================================
#
-bin_PROGRAMS = SALOME_Container SALOME_ContainerManagerServer TestContainerManager
+bin_PROGRAMS = SALOME_Container SALOME_ContainerManagerServer
SALOME_Container_SOURCES =\
SALOME_Container.cxx \
SALOME_Container_SignalsHandler.cxx
$(COMMON_LIBS) \
../Basics/libSALOMEBasics.la
-TestContainerManager_SOURCES =\
- TestContainerManager.cxx
-
-TestContainerManager_CPPFLAGS=\
- $(COMMON_CPPFLAGS)
-
-TestContainerManager_LDADD =\
- libSalomeContainer.la \
- $(COMMON_LIBS) \
- ../Basics/libSALOMEBasics.la
Engines::Container_ptr
SALOME_ContainerManager::
StartContainer(const Engines::MachineParameters& params,
- Engines::ResPolicy policy)
+ Engines::ResPolicy policy,
+ const Engines::CompoList& componentList)
{
- Engines::MachineList_var possibleComputers = GetFittingResources(params,"");
+ Engines::MachineList_var possibleComputers = GetFittingResources(params,componentList);
return StartContainer(params,possibleComputers,policy);
}
Engines::MachineList *
SALOME_ContainerManager::
GetFittingResources(const Engines::MachineParameters& params,
- const char *componentName)
+ const Engines::CompoList& componentList)
{
MESSAGE("SALOME_ContainerManager::GetFittingResources");
Engines::MachineList *ret=new Engines::MachineList;
vector<string> vec;
try
{
- vec = _ResManager->GetFittingResources(params,componentName);
+ vec = _ResManager->GetFittingResources(params,componentList);
}
catch(const SALOME_Exception &ex)
{
Engines::Container_ptr
StartContainer(const Engines::MachineParameters& params,
- Engines::ResPolicy policy);
+ Engines::ResPolicy policy,
+ const Engines::CompoList& componentList);
Engines::MachineList *
GetFittingResources(const Engines::MachineParameters& params,
- const char *componentName);
+ const Engines::CompoList& componentList);
char* FindFirst(const Engines::MachineList& possibleComputers);
+++ /dev/null
-// SALOME TestContainer : test of container creation and its life cycle
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//
-//
-// File : TestContainer.cxx
-// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
-// Module : SALOME
-// $Header$
-
-#include "utilities.h"
-#include <iostream>
-#include <unistd.h>
-#include <SALOMEconfig.h>
-#include "SALOME_NamingService.hxx"
-#include "SALOME_ContainerManager.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
-#include "NamingService_WaitForServerReadiness.hxx"
-#include "OpUtil.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "Utils_SALOME_Exception.hxx"
-#include "Utils_CommException.hxx"
-using namespace std;
-
-int main (int argc, char * argv[])
-{
- map<string, int> cycle;
- map<string, int> first;
- Engines::Container_ptr cont;
- Engines::Component_ptr compo;
- bool error = false;
- bool bestImplemented;
-
- // Initializing omniORB
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_ptr orb = init( argc , argv ) ;
-
- SALOME_NamingService *_NS=new SALOME_NamingService(orb);
-
- CORBA::Object_var obj = _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
- ASSERT( !CORBA::is_nil(obj));
- Engines::ContainerManager_var _ContManager=Engines::ContainerManager::_narrow(obj);
-
- Engines::MachineParameters p;
-
- p.hostname = "";
- p.OS = "LINUX";
- p.mem_mb = 1000;
- p.cpu_clock = 1000;
- p.nb_proc_per_node = 1;
- p.nb_node = 1;
- p.isMPI = false;
-
- char st[10];
- for(int i=0;i<10;i++){
- sprintf(st,"cycl_%d",i);
- p.container_name = CORBA::string_dup(st);
- cont = _ContManager->StartContainer(p,Engines::P_CYCL);
- if(CORBA::is_nil(cont)) error = true;
- }
-
- for(int i=0;i<10;i++){
- sprintf(st,"first_%d",i);
- p.container_name = CORBA::string_dup(st);
- cont = _ContManager->StartContainer(p,Engines::P_FIRST);
- if(CORBA::is_nil(cont)) error = true;
- }
-
- p.container_name = CORBA::string_dup("best");
- cont = _ContManager->StartContainer(p,Engines::P_BEST);
- if(CORBA::is_nil(cont)) bestImplemented = false;
- else bestImplemented = true;
-
- SALOME_LifeCycleCORBA LCC(_NS);
- compo = LCC.FindOrLoad_Component("FactoryServer","GEOM");
- if(CORBA::is_nil(compo)) error = true;
- compo = LCC.FindOrLoad_Component("FactoryServer","GEOM");
- if(CORBA::is_nil(compo)) error = true;
-
- _NS->Change_Directory("/Containers");
-
- vector<string> vec = _NS->list_directory_recurs();
- list<string> lstCont;
- for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont)){
- cycle[cont->getHostName()]=0;
- first[cont->getHostName()]=0;
- lstCont.push_back((*iter));
- }
- }
- for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont)){
- if(strncmp(basename(cont->name()),"cycl",4)==0)
- cycle[cont->getHostName()]++;
- if(strncmp(basename(cont->name()),"first",5)==0)
- first[cont->getHostName()]++;
- }
- }
- _ContManager->ShutdownContainers();
-
- int cmin=10;
- int cmax=0;
- int fmin=10;
- int fmax=0;
- int nbpmax;
- for(map<string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
- if(strcmp((*iter).first.c_str(),"localhost")!=0){
- Engines::MachineParameters *p = _ContManager->GetMachineParameters((*iter).first.c_str());
- int nbproc = p->nb_node * p->nb_proc_per_node;
- if(cycle[(*iter).first]/nbproc<cmin) cmin=cycle[(*iter).first]/nbproc;
- if(cycle[(*iter).first]/nbproc>cmax) cmax=cycle[(*iter).first]/nbproc;
- if(first[(*iter).first]/nbproc<fmin) fmin=first[(*iter).first]/nbproc;
- if(first[(*iter).first]/nbproc>fmax){
- fmax=first[(*iter).first]/nbproc;
- nbpmax = nbproc;
- }
- }
- }
- if( ((cmax-cmin) <= 1) && (fmax == 10/nbpmax) && !error ){
- string msg;
- if(bestImplemented)
- msg = "TEST OK";
- else
- msg = "TEST OK but FindBest not implemented!";
- MESSAGE(msg);
- return 0;
- }
- else{
- MESSAGE("TEST KO");
- return 1;
- }
-}
# This local variable defines the list of CPPFLAGS common to all target in this package.
COMMON_CPPFLAGS=\
+ @QT_MT_INCLUDES@ \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../SALOMETraceCollector \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
+ -I$(srcdir)/../Container \
-I$(srcdir)/../ResourcesManager \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
# Executables targets
# ===============================================================
#
-bin_PROGRAMS = Test_LifeCycleCORBA
+bin_PROGRAMS = Test_LifeCycleCORBA TestContainerManager
Test_LifeCycleCORBA_SOURCES = Test_LifeCycleCORBA.cxx
Test_LifeCycleCORBA_CPPFLAGS =\
-I$(srcdir)/../Registry \
$(COMMON_LIBS) \
@CORBA_LIBS@
+TestContainerManager_SOURCES = TestContainerManager.cxx
+TestContainerManager_CPPFLAGS =\
+ -I$(srcdir)/../Registry \
+ -I$(srcdir)/../Notification \
+ $(COMMON_CPPFLAGS)
+
+TestContainerManager_LDADD = \
+ libSalomeLifeCycleCORBA.la \
+ ../Registry/libRegistry.la \
+ ../Notification/libSalomeNotification.la \
+ ../Container/libSalomeContainer.la \
+ $(COMMON_LIBS) \
+ @CORBA_LIBS@
+
#CPPFLAGS += $(PYTHON_INCLUDES) $(QT_MT_INCLUDES)
#LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSalomeContainer -lSalomeResourcesManager
params.container_name = _containerName.c_str();
params.hostname = _refMachine.c_str();
+ Engines::CompoList clist;
Engines::MachineList_var listOfMachines =
- contManager->GetFittingResources(params, "");
+ contManager->GetFittingResources(params, clist);
container = contManager->FindOrStartContainer(params,
listOfMachines);
if (! isKnownComponentClass(componentName))
return Engines::Component::_nil();
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = componentName;
Engines::MachineList_var listOfMachines =
- _ContManager->GetFittingResources(params, componentName);
+ _ContManager->GetFittingResources(params, clist);
Engines::Component_var compo = _FindComponent(params,
componentName,
if (! isKnownComponentClass(componentName))
return Engines::Component::_nil();
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = componentName;
Engines::MachineList_var listOfMachines =
- _ContManager->GetFittingResources(params, componentName);
+ _ContManager->GetFittingResources(params, clist);
Engines::Component_var compo = _LoadComponent(params,
componentName,
if (! isKnownComponentClass(componentName))
return Engines::Component::_nil();
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = componentName;
Engines::MachineList_var listOfMachines =
- _ContManager->GetFittingResources(params,componentName);
+ _ContManager->GetFittingResources(params,clist);
Engines::Component_var compo = _FindComponent(params,
componentName,
Engines::MachineParameters params;
_LCC.preSet(params); // empty params to get all the machines
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = "SalomeTestComponent";
Engines::MachineList_var hostList =
- containerManager->GetFittingResources(params,"SalomeTestComponent");
+ containerManager->GetFittingResources(params,clist);
CPPUNIT_ASSERT(hostList->length() > 1);
string localHost = GetHostname();
--- /dev/null
+// SALOME TestContainer : test of container creation and its life cycle
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : TestContainer.cxx
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+// Module : SALOME
+// $Header$
+
+#include "utilities.h"
+#include <iostream>
+#include <unistd.h>
+#include <SALOMEconfig.h>
+#include "SALOME_NamingService.hxx"
+#include "SALOME_ContainerManager.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+#include "NamingService_WaitForServerReadiness.hxx"
+#include "OpUtil.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "Utils_SALOME_Exception.hxx"
+#include "Utils_CommException.hxx"
+using namespace std;
+
+int main (int argc, char * argv[])
+{
+ map<string, int> cycle;
+ map<string, int> first;
+ Engines::Container_ptr cont;
+ Engines::Component_ptr compo;
+ bool error = false;
+ bool bestImplemented;
+
+ // Initializing omniORB
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ CORBA::ORB_ptr orb = init( argc , argv ) ;
+
+ SALOME_NamingService *_NS=new SALOME_NamingService(orb);
+
+ CORBA::Object_var obj = _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
+ ASSERT( !CORBA::is_nil(obj));
+ Engines::ContainerManager_var _ContManager=Engines::ContainerManager::_narrow(obj);
+
+ Engines::MachineParameters p;
+ Engines::CompoList clist;
+ clist.length(2);
+ clist[0] = "MED";
+ clist[1] = "GEOM";
+
+ p.hostname = "";
+ p.OS = "LINUX";
+ p.mem_mb = 1000;
+ p.cpu_clock = 1000;
+ p.nb_proc_per_node = 1;
+ p.nb_node = 1;
+ p.isMPI = false;
+
+ char st[10];
+ for(int i=0;i<10;i++){
+ sprintf(st,"cycl_%d",i);
+ p.container_name = CORBA::string_dup(st);
+ cont = _ContManager->StartContainer(p,Engines::P_CYCL,clist);
+ if(CORBA::is_nil(cont)) error = true;
+ }
+
+ for(int i=0;i<10;i++){
+ sprintf(st,"first_%d",i);
+ p.container_name = CORBA::string_dup(st);
+ cont = _ContManager->StartContainer(p,Engines::P_FIRST,clist);
+ if(CORBA::is_nil(cont)) error = true;
+ }
+
+ p.container_name = CORBA::string_dup("best");
+ cont = _ContManager->StartContainer(p,Engines::P_BEST,clist);
+ if(CORBA::is_nil(cont)) bestImplemented = false;
+ else bestImplemented = true;
+
+ SALOME_LifeCycleCORBA LCC(_NS);
+ p.container_name = CORBA::string_dup("FactoryServer");
+ compo = LCC.FindOrLoad_Component(p,"SMESH");
+ if(CORBA::is_nil(compo)) error = true;
+ compo = LCC.FindOrLoad_Component(p,"SMESH");
+ if(CORBA::is_nil(compo)) error = true;
+
+ _NS->Change_Directory("/Containers");
+
+ vector<string> vec = _NS->list_directory_recurs();
+ list<string> lstCont;
+ for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont)){
+ cycle[cont->getHostName()]=0;
+ first[cont->getHostName()]=0;
+ lstCont.push_back((*iter));
+ }
+ }
+ for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont)){
+ if(strncmp(basename(cont->name()),"cycl",4)==0)
+ cycle[cont->getHostName()]++;
+ if(strncmp(basename(cont->name()),"first",5)==0)
+ first[cont->getHostName()]++;
+ }
+ }
+ _ContManager->ShutdownContainers();
+
+ int cmin=10;
+ int cmax=0;
+ int fmin=10;
+ int fmax=0;
+ int nbpmax;
+ for(map<string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
+ if(strcmp((*iter).first.c_str(),"localhost")!=0){
+ Engines::MachineParameters *p = _ContManager->GetMachineParameters((*iter).first.c_str());
+ int nbproc = p->nb_node * p->nb_proc_per_node;
+ if(cycle[(*iter).first]/nbproc<cmin) cmin=cycle[(*iter).first]/nbproc;
+ if(cycle[(*iter).first]/nbproc>cmax) cmax=cycle[(*iter).first]/nbproc;
+ if(first[(*iter).first]/nbproc<fmin) fmin=first[(*iter).first]/nbproc;
+ if(first[(*iter).first]/nbproc>fmax){
+ fmax=first[(*iter).first]/nbproc;
+ nbpmax = nbproc;
+ }
+ }
+ }
+ if( ((cmax-cmin) <= 1) && (fmax == 10/nbpmax) && !error ){
+ string msg;
+ if(bestImplemented)
+ msg = "TEST OK";
+ else
+ msg = "TEST OK but FindBest not implemented!";
+ MESSAGE(msg);
+ return 0;
+ }
+ else{
+ MESSAGE("TEST KO");
+ return 1;
+ }
+}
test_appli_path = "appliPath";
test_modules = "modules";
test_module_name = "moduleName";
- test_module_path = "modulePath";
- test_pre_req_file_path = "preReqFilePath";
test_os = "OS";
test_mem_in_mb = "memInMB";
test_cpu_freq_mhz = "CPUFreqMHz";
const QString& name,
const QXmlAttributes& attrs )
{
+ if( name.compare(QString(test_machine)) == 0 )
+ _resource.Clear();
for (int i = 0;i < attrs.count();i++)
{
QString qName(attrs.localName(i));
if ((qName.compare(QString(test_module_name)) == 0))
previous_module_name = content;
- if ((qName.compare(QString(test_module_path)) == 0))
- previous_module_path = content;
-
- if ((qName.compare(QString(test_pre_req_file_path)) == 0))
- _resource.PreReqFilePath = content;
-
if ((qName.compare(QString(test_os)) == 0))
_resource.OS = content;
const QString& qName)
{
if ((qName.compare(QString(test_modules)) == 0))
- _resource.ModulesPath[previous_module_name] = previous_module_path;
+ _resource.ModulesList.push_back(previous_module_name);
if ((qName.compare(QString(test_machine)) == 0)){
int nbnodes = _resource.DataForSort._nbOfNodes;
inode[0] = '\0' ;
sprintf(inode,"%s%d",clusterNode.c_str(),i+1);
std::string nodeName(inode);
-// _resource.DataForSort._nbOfNodes = 1;
_resource.DataForSort._hostName = nodeName ;
_resources_list[nodeName] = _resource;
- //cout << "SALOME_ResourcesCatalog_Handler::endElement _resources_list["
- // << nodeName << "] = _resource " << _resource.DataForSort._hostName.c_str()
- // << endl ;
}
}
else
bool SALOME_ResourcesCatalog_Handler::endDocument()
{
-// for (map<string, ParserResourcesType>::const_iterator iter =
-// _resources_list.begin();
-// iter != _resources_list.end();
-// iter++)
-// {
-// SCRUTE((*iter).second.Alias);
-// SCRUTE((*iter).second.UserName);
-// SCRUTE((*iter).second.AppliPath);
-// SCRUTE((*iter).second.PreReqFilePath);
-// SCRUTE((*iter).second.OS);
-// SCRUTE((*iter).second.Protocol);
-// SCRUTE((*iter).second.Mode);
-// }
+ map<string, ParserResourcesType>::const_iterator it;
+ for(it=_resources_list.begin();it!=_resources_list.end();it++)
+ (*it).second.Print();
-// MESSAGE("This is the end of document");
+ MESSAGE("This is the end of document");
return true;
}
eltRoot.setAttribute((char *)test_user_name,
(*iter).second.UserName.c_str());
- for (map<string, string>::const_iterator iter2 =
- (*iter).second.ModulesPath.begin();
- iter2 != (*iter).second.ModulesPath.end();
+ for (vector<string>::const_iterator iter2 =
+ (*iter).second.ModulesList.begin();
+ iter2 != (*iter).second.ModulesList.end();
iter2++)
{
- QDomElement rootForModulesPaths = doc.createElement(test_modules);
- rootForModulesPaths.setAttribute(test_module_name,
- (*iter2).first.c_str());
- rootForModulesPaths.setAttribute(test_module_path,
- (*iter2).second.c_str());
- eltRoot.appendChild(rootForModulesPaths);
+ QDomElement rootForModulesList = doc.createElement(test_modules);
+ rootForModulesList.setAttribute(test_module_name,
+ (*iter2).c_str());
+ eltRoot.appendChild(rootForModulesList);
}
- eltRoot.setAttribute(test_pre_req_file_path,
- (*iter).second.PreReqFilePath.c_str());
eltRoot.setAttribute(test_os, (*iter).second.OS.c_str());
eltRoot.setAttribute(test_mem_in_mb,
(*iter).second.DataForSort._memInMB);
QString errorProt;
std::string content;
std::string previous_module_name;
- std::string previous_module_path;
ParserResourcesType _resource;
MapOfParserResourcesType& _resources_list;
const char *test_appli_path;
const char *test_modules;
const char *test_module_name;
- const char *test_module_path;
- const char *test_pre_req_file_path;
const char *test_os;
const char *test_mem_in_mb;
const char *test_cpu_freq_mhz;
SCRUTE(_memInMB);
}
-void ParserResourcesType::Print()
+void ParserResourcesType::Print() const
{
- MESSAGE("##############*****");
- MESSAGE("HostName : " << DataForSort._hostName);
- MESSAGE("Alias : " << Alias);
- MESSAGE("Protocol : " << Protocol);
- MESSAGE("Mode : " << Mode);
- MESSAGE("UserName : " << UserName);
- MESSAGE("Modules : ");
- int i = 1;
-
- for (std::map<std::string, std::string>::iterator iter = ModulesPath.begin();
- iter != ModulesPath.end();
- iter++)
- {
- MESSAGE("Module " << i++ << " called : " << (*iter).first
- << " with path : " << (*iter).second);
- }
-
- MESSAGE("PreReqFilePath : " << PreReqFilePath);
- MESSAGE("OS : " << OS);
- DataForSort.Print();
+ ostringstream oss;
+ oss << endl <<
+ "HostName : " << DataForSort._hostName << endl <<
+ "Alias : " << Alias << endl <<
+ "NbOfNodes : " << DataForSort._nbOfNodes << endl <<
+ "NbOfProcPerNode : " << DataForSort._nbOfProcPerNode << endl <<
+ "CPUFreqMHz : " << DataForSort._CPUFreqMHz << endl <<
+ "MemInMB : " << DataForSort._memInMB << endl <<
+ "Protocol : " << Protocol << endl <<
+ "Mode : " << Mode << endl <<
+ "UserName : " << UserName << endl <<
+ "AppliPath : " << AppliPath << endl <<
+ "OS : " << OS << endl <<
+ "Modules : " << endl;
+
+ for(int i=0;i<ModulesList.size();i++)
+ oss << "Module " << i+1 << " called : " << ModulesList[i] << endl;
+
+ MESSAGE(oss.str());
+
+}
+
+void ParserResourcesType::Clear()
+{
+ DataForSort._hostName = "";
+ DataForSort._nbOfNodes = 1;
+ DataForSort._nbOfProcPerNode = 1;
+ DataForSort._CPUFreqMHz = 0;
+ DataForSort._memInMB = 0;
+ Alias = "";
+ Protocol = rsh;
+ Mode = interactive;
+ UserName = "";
+ AppliPath = "";
+ ModulesList.clear();
+ OS = "";
}
#include <map>
#include <iostream>
-typedef std::map<std::string, std::string> MapOfModulesPath;
-
enum AccessProtocolType {rsh, ssh};
enum AccessModeType {interactive, batch};
AccessModeType Mode;
std::string UserName;
std::string AppliPath;
- MapOfModulesPath ModulesPath;
- std::string PreReqFilePath;
+ std::vector<std::string> ModulesList;
std::string OS;
- void Print();
+ void Print() const;
+ void Clear();
};
typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
vector<string>
SALOME_ResourcesManager::
GetFittingResources(const Engines::MachineParameters& params,
- const char *moduleName)
+ const Engines::CompoList& componentList)
throw(SALOME_Exception)
{
// MESSAGE("ResourcesManager::GetFittingResources");
{
SelectOnlyResourcesWithOS(ret, params.OS);
- KeepOnlyResourcesWithModule(ret, moduleName);
+ KeepOnlyResourcesWithModule(ret, componentList);
if (ret.size() == 0)
SelectOnlyResourcesWithOS(ret, params.OS);
int
SALOME_ResourcesManager::
AddResourceInCatalog(const Engines::MachineParameters& paramsOfNewResources,
- const map<string, string>& modulesOnNewResources,
- const char *environPathOfPrerequired,
+ const vector<string>& modulesOnNewResources,
const char *alias,
const char *userName,
AccessModeType mode,
AccessProtocolType prot)
throw(SALOME_Exception)
{
- map<string, string>::const_iterator iter =
- modulesOnNewResources.find("KERNEL");
+ vector<string>::const_iterator iter = find(modulesOnNewResources.begin(),
+ modulesOnNewResources.end(),
+ "KERNEL");
if (iter != modulesOnNewResources.end())
{
newElt.Protocol = prot;
newElt.Mode = mode;
newElt.UserName = userName;
- newElt.ModulesPath = modulesOnNewResources;
- newElt.PreReqFilePath = environPathOfPrerequired;
+ newElt.ModulesList = modulesOnNewResources;
newElt.OS = paramsOfNewResources.OS;
newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb;
newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock;
command += machine;
command += " ";
- string path = (*(resInfo.ModulesPath.find("KERNEL"))).second;
+ string path = getenv("KERNEL_ROOT_DIR");
command += path;
command += "/bin/salome/";
void
SALOME_ResourcesManager::KeepOnlyResourcesWithModule
( vector<string>& hosts,
- const char *moduleName) const
+ const Engines::CompoList& componentList) const
throw(SALOME_Exception)
{
for (vector<string>::iterator iter = hosts.begin(); iter != hosts.end();)
{
MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
- const map<string, string>& mapOfModulesOfCurrentHost =
- (((*it).second).ModulesPath);
-
- if (mapOfModulesOfCurrentHost.find(moduleName) ==
- mapOfModulesOfCurrentHost.end())
+ const vector<string>& mapOfModulesOfCurrentHost = (((*it).second).ModulesList);
+
+ bool erasedHost = false;
+ if( mapOfModulesOfCurrentHost.size() > 0 ){
+ for(int i=0;i<componentList.length();i++){
+ vector<string>::const_iterator itt = find(mapOfModulesOfCurrentHost.begin(),
+ mapOfModulesOfCurrentHost.end(),
+ componentList[i]);
+ if (itt == mapOfModulesOfCurrentHost.end()){
+ erasedHost = true;
+ break;
+ }
+ }
+ }
+ if(erasedHost)
hosts.erase(iter);
else
iter++;
// --- set env vars
- tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
-
- for (map<string, string>::const_iterator iter = resInfo.ModulesPath.begin();
- iter != resInfo.ModulesPath.end();
- iter++)
- {
- string curModulePath((*iter).second);
- tempOutputFile << (*iter).first << "_ROOT_DIR=" << curModulePath << endl;
- tempOutputFile << "export " << (*iter).first << "_ROOT_DIR" << endl;
- tempOutputFile << "LD_LIBRARY_PATH=" << curModulePath
- << "/lib/salome" << ":${LD_LIBRARY_PATH}" << endl;
- tempOutputFile << "PYTHONPATH=" << curModulePath << "/bin/salome:"
- << curModulePath << "/lib/salome:" << curModulePath
- << "/lib/python${PYTHON_VERSION}/site-packages/salome:";
- tempOutputFile << curModulePath
- << "/lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules:${PYTHONPATH}"
- << endl;
- }
-
- tempOutputFile << "export LD_LIBRARY_PATH" << endl;
- tempOutputFile << "export PYTHONPATH" << endl;
tempOutputFile << "export SALOME_trace=local" << endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace"
//tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
#endif
}
- tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second
- << "/bin/salome/";
+ tempOutputFile << getenv("KERNEL_ROOT_DIR") << "/bin/salome/";
if (params.isMPI)
{
std::vector<std::string>
GetFittingResources(const Engines::MachineParameters& params,
- const char *moduleName)
+ const Engines::CompoList& componentList)
throw(SALOME_Exception);
std::string FindFirst(const Engines::MachineList& listOfMachines);
int AddResourceInCatalog
(const Engines::MachineParameters& paramsOfNewResources,
- const std::map<std::string, std::string>& modulesOnNewResources,
- const char *environPathOfPrerequired,
+ const std::vector<std::string>& modulesOnNewResources,
const char *alias,
const char *userName,
AccessModeType mode,
throw(SALOME_Exception);
void KeepOnlyResourcesWithModule(std::vector<std::string>& hosts,
- const char *moduleName) const
+ const Engines::CompoList& componentList) const
throw(SALOME_Exception);
void AddOmninamesParams(std::string& command) const;
#define TRACE_BUFFER_SIZE 256 // number of entries in circular buffer
// must be power of 2
-#define MAX_TRACE_LENGTH 256 // messages are truncated at this size
+#define MAX_TRACE_LENGTH 1024 // messages are truncated at this size
#include <pthread.h>
#include <semaphore.h>