From 63d467b9d24a0e9b9d2e880e694d7396854b2895 Mon Sep 17 00:00:00 2001 From: secher Date: Thu, 26 Nov 2009 14:32:00 +0000 Subject: [PATCH] update eSGE type batch and cluster internal protocol --- idl/SALOME_ContainerManager.idl | 2 + src/Launcher/Launcher_Job.cxx | 10 +-- src/Launcher/Launcher_Job_SALOME.cxx | 2 +- src/ResourcesManager/ResourcesManager.cxx | 4 +- src/ResourcesManager/ResourcesManager.hxx | 3 +- .../SALOME_ResourcesCatalog_Handler.cxx | 72 +++++++++++++++++++ .../SALOME_ResourcesCatalog_Handler.hxx | 1 + .../SALOME_ResourcesCatalog_Parser.cxx | 2 + .../SALOME_ResourcesCatalog_Parser.hxx | 2 + .../SALOME_ResourcesManager.cxx | 6 ++ 10 files changed, 96 insertions(+), 8 deletions(-) diff --git a/idl/SALOME_ContainerManager.idl b/idl/SALOME_ContainerManager.idl index 6108e22c2..ceef9c138 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -90,6 +90,8 @@ struct MachineDefinition string alias; //! protocol to use to start a remote container (ssh or rsh) string protocol; + //! cluster internal protocol to use to start a remote container (ssh or rsh) on the cluster + string iprotocol; //! login name to use to start a remote container string username; //! salome application to use to start a remote container diff --git a/src/Launcher/Launcher_Job.cxx b/src/Launcher/Launcher_Job.cxx index da1f5c2aa..69f2bd32d 100644 --- a/src/Launcher/Launcher_Job.cxx +++ b/src/Launcher/Launcher_Job.cxx @@ -373,16 +373,16 @@ Launcher::Job::updateJobState() LAUNCHER_MESSAGE("State received is: " << par[STATE].str()); // Patch until new LIBBATCH version - // eSSH Client and ePBS Client - if (par[STATE].str() == "Running" or par[STATE].str() == "E" or par[STATE].str() == "R") + // eSSH Client and ePBS Client and eSGE + if (par[STATE].str() == "Running" or par[STATE].str() == "E" or par[STATE].str() == "R" or par[STATE].str() == "r") _state = "RUNNING"; else if (par[STATE].str() == "Stopped") _state = "PAUSED"; - else if (par[STATE].str() == "Done" or par[STATE].str() == "U") + else if (par[STATE].str() == "Done" or par[STATE].str() == "U" or par[STATE].str() == "e") _state = "FINISHED"; - else if (par[STATE].str() == "Dead") + else if (par[STATE].str() == "Dead" or par[STATE].str() == "Eqw") _state = "ERROR"; - else if (par[STATE].str() == "Q") + else if (par[STATE].str() == "Q" or par[STATE].str() == "qw") _state = "QUEUED"; } #endif diff --git a/src/Launcher/Launcher_Job_SALOME.cxx b/src/Launcher/Launcher_Job_SALOME.cxx index c9e571fbf..484d2a679 100644 --- a/src/Launcher/Launcher_Job_SALOME.cxx +++ b/src/Launcher/Launcher_Job_SALOME.cxx @@ -70,7 +70,7 @@ Launcher::Job_SALOME::buildSalomeScript(Batch::Parametre params) // -- Generates Catalog Resources std::string machine_protocol = "ssh"; - if (_machine_definition.Protocol == rsh) + if (_machine_definition.ClusterInternalProtocol == rsh) machine_protocol = "rsh"; launch_script_stream << "if [ \"x$LIBBATCH_NODEFILE\" != \"x\" ]; then " << std::endl; diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index b5fb0b2df..7290c711e 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -300,7 +300,8 @@ AddResourceInCatalog(const machineParams& paramsOfNewResources, const char *alias, const char *userName, AccessModeType mode, - AccessProtocolType prot) + AccessProtocolType prot, + AccessProtocolType iprot) throw(ResourcesException) { vector::const_iterator iter = find(componentsOnNewResources.begin(), @@ -313,6 +314,7 @@ throw(ResourcesException) newElt.DataForSort._hostName = paramsOfNewResources.hostname; newElt.Alias = alias; newElt.Protocol = prot; + newElt.ClusterInternalProtocol = iprot; newElt.Mode = mode; newElt.UserName = userName; newElt.ComponentsList = componentsOnNewResources; diff --git a/src/ResourcesManager/ResourcesManager.hxx b/src/ResourcesManager/ResourcesManager.hxx index c66b71055..f7cbb5291 100644 --- a/src/ResourcesManager/ResourcesManager.hxx +++ b/src/ResourcesManager/ResourcesManager.hxx @@ -87,7 +87,8 @@ class RESOURCESMANAGER_EXPORT ResourcesManager_cpp const char *alias, const char *userName, AccessModeType mode, - AccessProtocolType prot) throw(ResourcesException); + AccessProtocolType prot, + AccessProtocolType iprot) throw(ResourcesException); void DeleteResourceInCatalog(const char *hostname); diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index c5e03db7d..ee24f2565 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -51,6 +51,7 @@ SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list, test_hostname = "hostname"; test_alias = "alias"; test_protocol = "protocol"; + test_cluster_internal_protocol = "iprotocol"; test_mode = "mode"; test_batch = "batch"; test_mpi = "mpi"; @@ -180,6 +181,7 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) std::cerr << (*iter).second.AppliPath << std::endl; std::cerr << (*iter).second.OS << std::endl; std::cerr << (*iter).second.Protocol << std::endl; + std::cerr << (*iter).second.ClusterInternalProtocol << std::endl; std::cerr << (*iter).second.Mode << std::endl; } #endif @@ -326,6 +328,31 @@ SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserRe return false; } + if (xmlHasProp(member_descr, (const xmlChar*)test_cluster_internal_protocol)) + { + xmlChar* iprotocol= xmlGetProp(member_descr, (const xmlChar*)test_cluster_internal_protocol); + switch (iprotocol[0]) + { + case 'r': + resource.ClusterInternalProtocol = rsh; + break; + case 's': + resource.ClusterInternalProtocol = ssh; + break; + default: + std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl; + std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl; + return false; + } + xmlFree(iprotocol); + } + else + { + std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl; + std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl; + return false; + } + if (xmlHasProp(member_descr, (const xmlChar*)test_user_name)) { xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name); @@ -445,6 +472,27 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser else resource.Protocol = rsh; + if (xmlHasProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol)) + { + xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol); + switch ( protocol[0]) + { + case 'r': + resource.ClusterInternalProtocol = rsh; + break; + case 's': + resource.ClusterInternalProtocol = ssh; + break; + default: + // If it'not in all theses cases, the protocol is affected to rsh + resource.ClusterInternalProtocol = rsh; + break; + } + xmlFree(protocol); + } + else + resource.ClusterInternalProtocol = rsh; + if (xmlHasProp(machine_descr, (const xmlChar*)test_mode)) { xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode); @@ -634,6 +682,18 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh"); } + switch ((*iter).second.ClusterInternalProtocol) + { + case rsh: + xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh"); + break; + case ssh: + xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "ssh"); + break; + default: + xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh"); + } + switch ((*iter).second.Mode) { case interactive: @@ -726,6 +786,18 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh"); } + switch ((*iter).second.ClusterInternalProtocol) + { + case rsh: + xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh"); + break; + case ssh: + xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "ssh"); + break; + default: + xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh"); + } + switch ((*iter).second.Mode) { case interactive: diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx index c0445989f..ffdbc54e8 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx @@ -69,6 +69,7 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesCatalog_Handler const char *test_hostname; const char *test_alias; const char *test_protocol; + const char *test_cluster_internal_protocol; const char *test_mode; const char *test_batch; const char *test_mpi; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx index 7d9b6b312..918d97d9d 100644 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx @@ -139,6 +139,7 @@ void ParserResourcesType::Print() "CPUFreqMHz : " << DataForSort._CPUFreqMHz << endl << "MemInMB : " << DataForSort._memInMB << endl << "Protocol : " << Protocol << endl << + "ClusterInternalProtocol : " << ClusterInternalProtocol << endl << "Mode : " << Mode << endl << "Batch : " << Batch << endl << "mpi : " << mpi << endl << @@ -177,6 +178,7 @@ void ParserResourcesType::Clear() HostName = ""; Alias = ""; Protocol = rsh; + ClusterInternalProtocol = rsh; Mode = interactive; Batch = none; mpi = nompi; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx index 3d00a9185..1b353f80b 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx @@ -77,6 +77,7 @@ struct RESOURCESMANAGER_EXPORT ParserResourcesClusterMembersType { std::string HostName; AccessProtocolType Protocol; + AccessProtocolType ClusterInternalProtocol; std::string UserName; std::string AppliPath; ResourceDataToSort DataForSort; @@ -88,6 +89,7 @@ struct RESOURCESMANAGER_EXPORT ParserResourcesType std::string HostName; std::string Alias; AccessProtocolType Protocol; + AccessProtocolType ClusterInternalProtocol; AccessModeType Mode; BatchType Batch; MpiImplType mpi; diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 6d4fa049d..e0b92ef64 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -210,6 +210,10 @@ Engines::MachineDefinition* SALOME_ResourcesManager::GetMachineParameters(const p_ptr->protocol = "rsh"; else if( resource.Protocol == ssh ) p_ptr->protocol = "ssh"; + if( resource.ClusterInternalProtocol == rsh ) + p_ptr->iprotocol = "rsh"; + else if( resource.ClusterInternalProtocol == ssh ) + p_ptr->iprotocol = "ssh"; p_ptr->username = CORBA::string_dup(resource.UserName.c_str()); p_ptr->applipath = CORBA::string_dup(resource.AppliPath.c_str()); p_ptr->componentList.length(resource.ComponentsList.size()); @@ -267,6 +271,7 @@ SALOME_ResourcesManager::getMachineFile(std::string hostname, CORBA::Long nb_pro ParserResourcesClusterMembersType fake_node; fake_node.HostName = resource.HostName; fake_node.Protocol = resource.Protocol; + fake_node.ClusterInternalProtocol = resource.ClusterInternalProtocol; fake_node.UserName = resource.UserName; fake_node.AppliPath = resource.AppliPath; fake_node.DataForSort = resource.DataForSort; @@ -324,6 +329,7 @@ SALOME_ResourcesManager::getMachineFile(std::string hostname, CORBA::Long nb_pro ParserResourcesClusterMembersType fake_node; fake_node.HostName = resource.HostName; fake_node.Protocol = resource.Protocol; + fake_node.ClusterInternalProtocol = resource.ClusterInternalProtocol; fake_node.UserName = resource.UserName; fake_node.AppliPath = resource.AppliPath; fake_node.DataForSort = resource.DataForSort; -- 2.39.2