-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
//
#include "SALOME_ResourcesCatalog_Handler.hxx"
#include "Basics_Utils.hxx"
+#include "Utils_SALOME_Exception.hxx"
#include <iostream>
#include <sstream>
#include <map>
test_user_commands = "userCommands";
test_use = "use";
test_members = "members";
+ test_is_cluster_head = "isClusterHead";
+ test_working_directory = "workingDirectory";
}
//=============================================================================
resource.mpi = mpich2;
else if (anMpi == "openmpi")
resource.mpi = openmpi;
- else if (anMpi == "slurm")
- resource.mpi = slurm;
+ else if (anMpi == "slurmmpi")
+ resource.mpi = slurmmpi;
else if (anMpi == "prun")
resource.mpi = prun;
else
if (xmlHasProp(member_descr, (const xmlChar*)test_protocol))
{
xmlChar* protocol= xmlGetProp(member_descr, (const xmlChar*)test_protocol);
- switch (protocol[0])
+ try
{
- case 'r':
- resource.Protocol = rsh;
- break;
- case 's':
- resource.Protocol = 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;
+ resource.Protocol = ParserResourcesType::stringToProtocol((const char *)protocol);
+ }
+ catch (SALOME_Exception e)
+ {
+ 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(protocol);
}
if (xmlHasProp(member_descr, (const xmlChar*)test_cluster_internal_protocol))
{
xmlChar* iprotocol= xmlGetProp(member_descr, (const xmlChar*)test_cluster_internal_protocol);
- switch (iprotocol[0])
+ try
{
- 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;
+ resource.ClusterInternalProtocol = ParserResourcesType::stringToProtocol((const char *)iprotocol);
+ }
+ catch (SALOME_Exception e)
+ {
+ 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);
}
if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
{
xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
- switch ( protocol[0])
+ try
{
- case 'r':
- resource.Protocol = rsh;
- break;
- case 's':
- resource.Protocol = ssh;
- break;
- default:
- // If it'not in all theses cases, the protocol is affected to rsh
- resource.Protocol = rsh;
- break;
+ resource.Protocol = ParserResourcesType::stringToProtocol((const char *)protocol);
+ }
+ catch (SALOME_Exception e)
+ {
+ // If it'not in all theses cases, the protocol is affected to rsh
+ resource.Protocol = rsh;
}
xmlFree(protocol);
}
if (xmlHasProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol))
{
xmlChar* iprotocol= xmlGetProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol);
- switch ( iprotocol[0])
+ try
{
- 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;
+ resource.ClusterInternalProtocol = ParserResourcesType::stringToProtocol((const char *)iprotocol);
+ }
+ catch (SALOME_Exception e)
+ {
+ // If it'not in all theses cases, the protocol is affected to rsh
+ resource.ClusterInternalProtocol = rsh;
}
xmlFree(iprotocol);
}
resource.Batch = ssh_batch;
else if (aBatch == "ccc")
resource.Batch = ccc;
+ else if (aBatch == "slurm")
+ resource.Batch = slurm;
else if (aBatch == "ll")
resource.Batch = ll;
+ else if (aBatch == "vishnu")
+ resource.Batch = vishnu;
else
resource.Batch = none;
}
resource.mpi = mpich2;
else if (anMpi == "openmpi")
resource.mpi = openmpi;
- else if (anMpi == "slurm")
- resource.mpi = slurm;
+ else if (anMpi == "slurmmpi")
+ resource.mpi = slurmmpi;
else if (anMpi == "prun")
resource.mpi = prun;
else
xmlFree(nb_of_proc_per_node);
}
+ if (xmlHasProp(machine_descr, (const xmlChar*)test_is_cluster_head))
+ {
+ xmlChar* is_cluster_head = xmlGetProp(machine_descr, (const xmlChar*)test_is_cluster_head);
+ std::string str_ich = (const char*)is_cluster_head;
+ if (str_ich == "true")
+ {
+ resource.is_cluster_head = true;
+ }
+ else
+ {
+ resource.is_cluster_head = false;
+ }
+ xmlFree(is_cluster_head);
+ }
+ else
+ {
+ resource.is_cluster_head = false;
+ }
+
+ if (xmlHasProp(machine_descr, (const xmlChar*)test_working_directory))
+ {
+ xmlChar* working_directory = xmlGetProp(machine_descr, (const xmlChar*)test_working_directory);
+ resource.working_directory = (const char*)working_directory;
+ xmlFree(working_directory);
+ }
+ else
+ {
+ resource.working_directory = "";
+ }
+
// Process children nodes
xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
while(aCurSubNode != NULL)
xmlNewProp(node, BAD_CAST test_appli_path, BAD_CAST (*iter).second.AppliPath.c_str());
xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
-
- switch ((*iter).second.Protocol)
- {
- case rsh:
- xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
- break;
- case ssh:
- xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
- break;
- default:
- 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");
- }
+ xmlNewProp(node,
+ BAD_CAST test_protocol,
+ BAD_CAST ParserResourcesType::protocolToString((*iter).second.Protocol).c_str());
+ xmlNewProp(node,
+ BAD_CAST test_cluster_internal_protocol,
+ BAD_CAST ParserResourcesType::protocolToString((*iter).second.ClusterInternalProtocol).c_str());
+ xmlNewProp(node, BAD_CAST test_working_directory, BAD_CAST (*iter).second.working_directory.c_str());
+ if ((*iter).second.is_cluster_head)
+ xmlNewProp(node, BAD_CAST test_is_cluster_head, BAD_CAST "true");
+ else
+ xmlNewProp(node, BAD_CAST test_is_cluster_head, BAD_CAST "false");
switch ((*iter).second.Mode)
{
case ccc:
xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ccc");
break;
+ case slurm:
+ xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "slurm");
+ break;
case ssh_batch:
xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ssh_batch");
break;
case ll:
xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ll");
break;
+ case vishnu:
+ xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "vishnu");
+ break;
default:
xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
}
case openmpi:
xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
break;
- case slurm:
- xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
+ case slurmmpi:
+ xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurmmpi");
break;
case prun:
xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");