1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
24 // File : SALOME_ResourcesCatalog_Handler.cxx
25 // Author : Estelle Deville
29 #include "SALOME_ResourcesCatalog_Handler.hxx"
30 #include "Basics_Utils.hxx"
35 //=============================================================================
38 * \param listOfResources: map of ParserResourcesType to fill when parsing
40 //=============================================================================
42 SALOME_ResourcesCatalog_Handler::
43 SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list): _resources_list(resources_list)
45 //XML tags initialisation
46 test_machine = "machine";
47 test_cluster = "cluster";
49 test_hostname = "hostname";
50 test_protocol = "protocol";
51 test_cluster_internal_protocol = "iprotocol";
55 test_user_name = "userName";
56 test_appli_path = "appliPath";
57 test_modules = "modules";
58 test_module_name = "moduleName";
59 test_components = "component";
60 test_component_name = "name";
62 test_mem_in_mb = "memInMB";
63 test_cpu_freq_mhz = "CPUFreqMHz";
64 test_nb_of_nodes = "nbOfNodes";
65 test_nb_of_proc = "nbOfProc";
66 test_nb_of_proc_per_node = "nbOfProcPerNode";
67 test_batch_queue = "batchQueue";
68 test_user_commands = "userCommands";
70 test_members = "members";
73 //=============================================================================
77 //=============================================================================
79 SALOME_ResourcesCatalog_Handler::~SALOME_ResourcesCatalog_Handler()
81 // cout << "SALOME_ResourcesCatalog_Handler destruction") << endl;
84 //=============================================================================
86 * Retrieves DS after the file parse.
88 //=============================================================================
90 const MapOfParserResourcesType&
91 SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const
93 return _resources_list;
96 //=============================================================================
98 * Processes XML document and fills the list of resources
100 //=============================================================================
102 void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
104 // Empty private elements
105 _resources_list.clear();
109 _resource.HostName = Kernel_Utils::GetHostname();
110 _resource.Name = Kernel_Utils::GetHostname();
111 _resource.DataForSort._Name = Kernel_Utils::GetHostname();
112 _resources_list[Kernel_Utils::GetHostname()] = _resource;
114 // Get the document root node
115 xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
117 aCurNode = aCurNode->xmlChildrenNode;
119 // Processing the document nodes
120 while(aCurNode != NULL)
122 // Cas d'une machine ou d'une machine batch
123 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine))
126 bool Ok = ProcessMachine(aCurNode, _resource);
130 if(_resource.HostName == "localhost")
132 _resource.HostName = Kernel_Utils::GetHostname();
134 std::map<std::string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
135 if (iter != _resources_list.end())
136 RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
137 _resources_list[_resource.Name] = _resource;
140 // Cas de la déclaration d'un cluster
141 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster))
144 if(ProcessCluster(aCurNode, _resource))
146 std::map<std::string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
147 if (iter != _resources_list.end())
148 RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
149 _resources_list[_resource.Name] = _resource;
152 aCurNode = aCurNode->next;
156 for (std::map<std::string, ParserResourcesType>::const_iterator iter = _resources_list.begin();
157 iter != _resources_list.end();
160 std::cerr << "************************************************" << std::endl;
161 std::cerr << "Resource " << (*iter).first << " found:" << std::endl;
162 std::cerr << " Name: " << (*iter).second.Name << std::endl;
163 std::cerr << " Hostname: " << (*iter).second.HostName << std::endl;
164 std::cerr << " Username: " << (*iter).second.UserName << std::endl;
165 std::cerr << " Appli path: " <<(*iter).second.AppliPath << std::endl;
166 std::cerr << " OS: " << (*iter).second.OS << std::endl;
167 std::cerr << " Protocol: " << (*iter).second.PrintAccessProtocolType() << std::endl;
168 std::cerr << " Internal Protocol: " <<(*iter).second.PrintClusterInternalProtocol() << std::endl;
169 std::cerr << " Mode: " << (*iter).second.PrintAccessModeType() << std::endl;
170 std::cerr << " Batch Type: " << (*iter).second.PrintBatchType() << std::endl;
171 std::cerr << " MPI Impl: " << (*iter).second.PrintMpiImplType() << std::endl;
172 std::cerr << "************************************************" << std::endl;
178 SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, ParserResourcesType & resource)
180 // Ajout d'un cluster
181 // hostname, use et nbOfProc sont obligatoires
182 if (xmlHasProp(cluster_descr, (const xmlChar*)test_hostname))
184 xmlChar* hostname = xmlGetProp(cluster_descr, (const xmlChar*)test_hostname);
185 resource.HostName = (const char*)hostname;
190 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a hostname" << std::endl;
191 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
195 if (xmlHasProp(cluster_descr, (const xmlChar*)test_name))
197 xmlChar* name = xmlGetProp(cluster_descr, (const xmlChar*)test_name);
198 resource.Name = (const char*)name;
199 resource.DataForSort._Name = (const char*)name;
204 resource.Name = resource.HostName;
205 resource.DataForSort._Name = resource.HostName;
206 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
209 if (xmlHasProp(cluster_descr, (const xmlChar*)test_use))
211 xmlChar* use = xmlGetProp(cluster_descr, (const xmlChar*)test_use);
212 resource.use = (const char*)use;
217 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a use" << std::endl;
218 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
222 if (xmlHasProp(cluster_descr, (const xmlChar*)test_nb_of_proc))
224 xmlChar* nb_of_proc = xmlGetProp(cluster_descr, (const xmlChar*)test_nb_of_proc);
225 resource.nbOfProc = atoi((const char*)nb_of_proc);
230 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a nbOfProc" << std::endl;
231 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
235 if (xmlHasProp(cluster_descr, (const xmlChar*)test_mpi))
237 xmlChar* mpi = xmlGetProp(cluster_descr, (const xmlChar*)test_mpi);
238 std::string anMpi = (const char*)mpi;
242 else if (anMpi == "mpich1")
243 resource.mpi = mpich1;
244 else if (anMpi == "mpich2")
245 resource.mpi = mpich2;
246 else if (anMpi == "openmpi")
247 resource.mpi = openmpi;
248 else if (anMpi == "slurm")
249 resource.mpi = slurm;
250 else if (anMpi == "prun")
253 resource.mpi = nompi;
256 // Parsing des membres du cluster
257 xmlNodePtr aCurSubNode = cluster_descr->xmlChildrenNode;
258 while(aCurSubNode != NULL)
260 if (!xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_members))
262 xmlNodePtr members = aCurSubNode->xmlChildrenNode;
263 while (members != NULL)
266 if (!xmlStrcmp(members->name, (const xmlChar*)test_machine))
268 ParserResourcesClusterMembersType new_member;
269 if (ProcessMember(members, new_member))
270 resource.ClusterMembersList.push_back(new_member);
272 members = members->next;
275 aCurSubNode = aCurSubNode->next;
278 // Test: Il faut au moins un membre pour que le cluster soit correct !
279 if (resource.ClusterMembersList.empty())
281 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a member" << std::endl;
282 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
289 SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserResourcesClusterMembersType & resource)
291 if (xmlHasProp(member_descr, (const xmlChar*)test_hostname))
293 xmlChar* hostname = xmlGetProp(member_descr, (const xmlChar*)test_hostname);
294 resource.HostName = (const char*)hostname;
299 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a hostname" << std::endl;
300 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
304 if (xmlHasProp(member_descr, (const xmlChar*)test_protocol))
306 xmlChar* protocol= xmlGetProp(member_descr, (const xmlChar*)test_protocol);
310 resource.Protocol = rsh;
313 resource.Protocol = ssh;
316 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
317 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
324 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
325 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
329 if (xmlHasProp(member_descr, (const xmlChar*)test_cluster_internal_protocol))
331 xmlChar* iprotocol= xmlGetProp(member_descr, (const xmlChar*)test_cluster_internal_protocol);
332 switch (iprotocol[0])
335 resource.ClusterInternalProtocol = rsh;
338 resource.ClusterInternalProtocol = ssh;
341 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
342 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
349 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
350 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
354 if (xmlHasProp(member_descr, (const xmlChar*)test_user_name))
356 xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name);
357 resource.UserName = (const char*)user_name;
362 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a user name" << std::endl;
363 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
367 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_nodes))
369 xmlChar* nb_of_nodes = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_nodes);
370 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
371 xmlFree(nb_of_nodes);
375 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfNodes" << std::endl;
376 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
380 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node))
382 xmlChar* nb_of_proc_per_node = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node);
383 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
384 xmlFree(nb_of_proc_per_node);
388 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfProcPerNode" << std::endl;
389 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
393 if (xmlHasProp(member_descr, (const xmlChar*)test_appli_path))
395 xmlChar* appli_path = xmlGetProp(member_descr, (const xmlChar*)test_appli_path);
396 resource.AppliPath = (const char*)appli_path;
401 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a AppliPath" << std::endl;
402 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
409 SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, ParserResourcesType & resource)
411 if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
413 xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
414 resource.HostName = (const char*)hostname;
419 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning found a machine without a hostname" << std::endl;
420 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning this machine will not be added" << std::endl;
424 if (xmlHasProp(machine_descr, (const xmlChar*)test_name))
426 xmlChar* name = xmlGetProp(machine_descr, (const xmlChar*)test_name);
427 resource.Name = (const char*)name;
428 resource.DataForSort._Name = (const char*)name;
433 resource.Name = resource.HostName;
434 resource.DataForSort._Name = resource.HostName;
435 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
438 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
440 xmlChar* batch_queue = xmlGetProp(machine_descr, (const xmlChar*)test_batch_queue);
441 resource.batchQueue = (const char*)batch_queue;
442 xmlFree(batch_queue);
445 resource.batchQueue = "";
447 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_commands))
449 xmlChar* user_commands= xmlGetProp(machine_descr, (const xmlChar*)test_user_commands);
450 resource.userCommands = (const char*)user_commands;
451 xmlFree(user_commands);
454 resource.userCommands = "";
456 if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
458 xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
459 switch ( protocol[0])
462 resource.Protocol = rsh;
465 resource.Protocol = ssh;
468 // If it'not in all theses cases, the protocol is affected to rsh
469 resource.Protocol = rsh;
475 resource.Protocol = rsh;
477 if (xmlHasProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol))
479 xmlChar* iprotocol= xmlGetProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol);
480 switch ( iprotocol[0])
483 resource.ClusterInternalProtocol = rsh;
486 resource.ClusterInternalProtocol = ssh;
489 // If it'not in all theses cases, the protocol is affected to rsh
490 resource.ClusterInternalProtocol = rsh;
496 resource.ClusterInternalProtocol = resource.Protocol;
498 if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
500 xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
504 resource.Mode = interactive;
507 resource.Mode = batch;
510 // If it'not in all theses cases, the mode is affected to interactive
511 resource.Mode = interactive;
517 resource.Mode = interactive;
519 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch))
521 xmlChar* batch = xmlGetProp(machine_descr, (const xmlChar*)test_batch);
522 std::string aBatch = (const char*)batch;
525 resource.Batch = pbs;
526 else if (aBatch == "lsf")
527 resource.Batch = lsf;
528 else if (aBatch == "sge")
529 resource.Batch = sge;
530 else if (aBatch == "ssh_batch")
531 resource.Batch = ssh_batch;
532 else if (aBatch == "ccc")
533 resource.Batch = ccc;
534 else if (aBatch == "ll")
537 resource.Batch = none;
540 if (xmlHasProp(machine_descr, (const xmlChar*)test_mpi))
542 xmlChar* mpi = xmlGetProp(machine_descr, (const xmlChar*)test_mpi);
543 std::string anMpi = (const char*)mpi;
547 else if (anMpi == "mpich1")
548 resource.mpi = mpich1;
549 else if (anMpi == "mpich2")
550 resource.mpi = mpich2;
551 else if (anMpi == "openmpi")
552 resource.mpi = openmpi;
553 else if (anMpi == "slurm")
554 resource.mpi = slurm;
555 else if (anMpi == "prun")
558 resource.mpi = nompi;
561 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_name))
563 xmlChar* user_name= xmlGetProp(machine_descr, (const xmlChar*)test_user_name);
564 resource.UserName = (const char*)user_name;
568 if (xmlHasProp(machine_descr, (const xmlChar*)test_appli_path))
570 xmlChar* appli_path = xmlGetProp(machine_descr, (const xmlChar*)test_appli_path);
571 resource.AppliPath = (const char*)appli_path;
575 if (xmlHasProp(machine_descr, (const xmlChar*)test_os))
577 xmlChar* os = xmlGetProp(machine_descr, (const xmlChar*)test_os);
578 resource.OS = (const char*)os;
582 if (xmlHasProp(machine_descr, (const xmlChar*)test_mem_in_mb))
584 xmlChar* mem_in_mb = xmlGetProp(machine_descr, (const xmlChar*)test_mem_in_mb);
585 resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
589 if (xmlHasProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz))
591 xmlChar* cpu_freq_mhz = xmlGetProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz);
592 resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
593 xmlFree(cpu_freq_mhz);
596 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_nodes))
598 xmlChar* nb_of_nodes = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_nodes);
599 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
600 xmlFree(nb_of_nodes);
603 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node))
605 xmlChar* nb_of_proc_per_node = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node);
606 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
607 xmlFree(nb_of_proc_per_node);
610 // Process children nodes
611 xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
612 while(aCurSubNode != NULL)
614 // Process components
615 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
617 //If a component is given, it is in a module with the same name
618 //except if the module name is given
619 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
621 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
622 std::string aComponentName = (const char*)component_name;
623 _resource.ComponentsList.push_back(aComponentName);
624 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
626 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
627 std::string aModuleName = (const char*)module_name;
628 _resource.ModulesList.push_back(aModuleName);
629 xmlFree(module_name);
632 _resource.ModulesList.push_back(aComponentName);
633 xmlFree(component_name);
637 else if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
639 // If a module is given, we create an entry in componentsList and modulesList
640 // with the same name (module == component)
641 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
643 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
644 std::string aComponentName = (const char*)component_name;
645 _resource.ComponentsList.push_back(aComponentName);
646 _resource.ModulesList.push_back(aComponentName);
647 xmlFree(component_name);
650 aCurSubNode = aCurSubNode->next;
655 //=============================================================================
657 * Fill the document tree in xml file, used to write in an xml file.
658 * \param theDoc document to fill.
660 //=============================================================================
662 void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
665 xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
667 root_node = xmlNewNode(NULL, BAD_CAST "resources");
668 xmlDocSetRootElement(theDoc, root_node);
670 std::map<std::string, ParserResourcesType>::iterator iter = _resources_list.begin();
671 for (; iter != _resources_list.end(); iter++)
673 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
674 RES_MESSAGE("Add resource name = " << (*iter).second.Name.c_str());
675 xmlNewProp(node, BAD_CAST test_name, BAD_CAST (*iter).second.Name.c_str());
676 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
677 xmlNewProp(node, BAD_CAST test_appli_path, BAD_CAST (*iter).second.AppliPath.c_str());
678 xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
679 xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
681 switch ((*iter).second.Protocol)
684 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
687 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
690 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
693 switch ((*iter).second.ClusterInternalProtocol)
696 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
699 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "ssh");
702 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
705 switch ((*iter).second.Mode)
708 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
711 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
714 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
717 switch ((*iter).second.Batch)
720 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
723 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
726 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
729 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ccc");
732 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ssh_batch");
735 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ll");
738 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
741 switch ((*iter).second.mpi)
744 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
747 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
750 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
753 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
756 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
759 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
762 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
765 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
767 std::vector<std::string>::const_iterator iter2 = (*iter).second.ComponentsList.begin();
768 for(;iter2 != (*iter).second.ComponentsList.end(); iter2++)
770 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
771 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
774 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
775 std::ostringstream mem_stream;
776 mem_stream << (*iter).second.DataForSort._memInMB;
777 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST mem_stream.str().c_str());
778 std::ostringstream cpu_stream;
779 cpu_stream << (*iter).second.DataForSort._CPUFreqMHz;
780 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST cpu_stream.str().c_str());
781 std::ostringstream nb_nodes_stream;
782 nb_nodes_stream << (*iter).second.DataForSort._nbOfNodes;
783 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST nb_nodes_stream.str().c_str());
784 std::ostringstream nb_proc_per_nodes_stream;
785 nb_proc_per_nodes_stream << (*iter).second.DataForSort._nbOfProcPerNode;
786 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST nb_proc_per_nodes_stream.str().c_str());