1 // Copyright (C) 2007-2011 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"
31 #include "Utils_SALOME_Exception.hxx"
36 //=============================================================================
39 * \param listOfResources: map of ParserResourcesType to fill when parsing
41 //=============================================================================
43 SALOME_ResourcesCatalog_Handler::
44 SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list): _resources_list(resources_list)
46 //XML tags initialisation
47 test_machine = "machine";
48 test_cluster = "cluster";
50 test_hostname = "hostname";
51 test_protocol = "protocol";
52 test_cluster_internal_protocol = "iprotocol";
56 test_user_name = "userName";
57 test_appli_path = "appliPath";
58 test_modules = "modules";
59 test_module_name = "moduleName";
60 test_components = "component";
61 test_component_name = "name";
63 test_mem_in_mb = "memInMB";
64 test_cpu_freq_mhz = "CPUFreqMHz";
65 test_nb_of_nodes = "nbOfNodes";
66 test_nb_of_proc = "nbOfProc";
67 test_nb_of_proc_per_node = "nbOfProcPerNode";
68 test_batch_queue = "batchQueue";
69 test_user_commands = "userCommands";
71 test_members = "members";
74 //=============================================================================
78 //=============================================================================
80 SALOME_ResourcesCatalog_Handler::~SALOME_ResourcesCatalog_Handler()
82 // cout << "SALOME_ResourcesCatalog_Handler destruction") << endl;
85 //=============================================================================
87 * Retrieves DS after the file parse.
89 //=============================================================================
91 const MapOfParserResourcesType&
92 SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const
94 return _resources_list;
97 //=============================================================================
99 * Processes XML document and fills the list of resources
101 //=============================================================================
103 void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
105 // Empty private elements
106 _resources_list.clear();
110 _resource.HostName = Kernel_Utils::GetHostname();
111 _resource.Name = Kernel_Utils::GetHostname();
112 _resource.DataForSort._Name = Kernel_Utils::GetHostname();
113 _resources_list[Kernel_Utils::GetHostname()] = _resource;
115 // Get the document root node
116 xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
118 aCurNode = aCurNode->xmlChildrenNode;
120 // Processing the document nodes
121 while(aCurNode != NULL)
123 // Cas d'une machine ou d'une machine batch
124 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine))
127 bool Ok = ProcessMachine(aCurNode, _resource);
131 if(_resource.HostName == "localhost")
133 _resource.HostName = Kernel_Utils::GetHostname();
135 std::map<std::string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
136 if (iter != _resources_list.end())
137 RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
138 _resources_list[_resource.Name] = _resource;
141 // Cas de la déclaration d'un cluster
142 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster))
145 if(ProcessCluster(aCurNode, _resource))
147 std::map<std::string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
148 if (iter != _resources_list.end())
149 RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
150 _resources_list[_resource.Name] = _resource;
153 aCurNode = aCurNode->next;
157 for (std::map<std::string, ParserResourcesType>::const_iterator iter = _resources_list.begin();
158 iter != _resources_list.end();
161 std::cerr << "************************************************" << std::endl;
162 std::cerr << "Resource " << (*iter).first << " found:" << std::endl;
163 std::cerr << " Name: " << (*iter).second.Name << std::endl;
164 std::cerr << " Hostname: " << (*iter).second.HostName << std::endl;
165 std::cerr << " Username: " << (*iter).second.UserName << std::endl;
166 std::cerr << " Appli path: " <<(*iter).second.AppliPath << std::endl;
167 std::cerr << " OS: " << (*iter).second.OS << std::endl;
168 std::cerr << " Protocol: " << (*iter).second.PrintAccessProtocolType() << std::endl;
169 std::cerr << " Internal Protocol: " <<(*iter).second.PrintClusterInternalProtocol() << std::endl;
170 std::cerr << " Mode: " << (*iter).second.PrintAccessModeType() << std::endl;
171 std::cerr << " Batch Type: " << (*iter).second.PrintBatchType() << std::endl;
172 std::cerr << " MPI Impl: " << (*iter).second.PrintMpiImplType() << std::endl;
173 std::cerr << "************************************************" << std::endl;
179 SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, ParserResourcesType & resource)
181 // Ajout d'un cluster
182 // hostname, use et nbOfProc sont obligatoires
183 if (xmlHasProp(cluster_descr, (const xmlChar*)test_hostname))
185 xmlChar* hostname = xmlGetProp(cluster_descr, (const xmlChar*)test_hostname);
186 resource.HostName = (const char*)hostname;
191 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a hostname" << std::endl;
192 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
196 if (xmlHasProp(cluster_descr, (const xmlChar*)test_name))
198 xmlChar* name = xmlGetProp(cluster_descr, (const xmlChar*)test_name);
199 resource.Name = (const char*)name;
200 resource.DataForSort._Name = (const char*)name;
205 resource.Name = resource.HostName;
206 resource.DataForSort._Name = resource.HostName;
207 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
210 if (xmlHasProp(cluster_descr, (const xmlChar*)test_use))
212 xmlChar* use = xmlGetProp(cluster_descr, (const xmlChar*)test_use);
213 resource.use = (const char*)use;
218 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a use" << std::endl;
219 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
223 if (xmlHasProp(cluster_descr, (const xmlChar*)test_nb_of_proc))
225 xmlChar* nb_of_proc = xmlGetProp(cluster_descr, (const xmlChar*)test_nb_of_proc);
226 resource.nbOfProc = atoi((const char*)nb_of_proc);
231 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a nbOfProc" << std::endl;
232 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
236 if (xmlHasProp(cluster_descr, (const xmlChar*)test_mpi))
238 xmlChar* mpi = xmlGetProp(cluster_descr, (const xmlChar*)test_mpi);
239 std::string anMpi = (const char*)mpi;
243 else if (anMpi == "mpich1")
244 resource.mpi = mpich1;
245 else if (anMpi == "mpich2")
246 resource.mpi = mpich2;
247 else if (anMpi == "openmpi")
248 resource.mpi = openmpi;
249 else if (anMpi == "slurmmpi")
250 resource.mpi = slurmmpi;
251 else if (anMpi == "prun")
254 resource.mpi = nompi;
257 // Parsing des membres du cluster
258 xmlNodePtr aCurSubNode = cluster_descr->xmlChildrenNode;
259 while(aCurSubNode != NULL)
261 if (!xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_members))
263 xmlNodePtr members = aCurSubNode->xmlChildrenNode;
264 while (members != NULL)
267 if (!xmlStrcmp(members->name, (const xmlChar*)test_machine))
269 ParserResourcesClusterMembersType new_member;
270 if (ProcessMember(members, new_member))
271 resource.ClusterMembersList.push_back(new_member);
273 members = members->next;
276 aCurSubNode = aCurSubNode->next;
279 // Test: Il faut au moins un membre pour que le cluster soit correct !
280 if (resource.ClusterMembersList.empty())
282 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a member" << std::endl;
283 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
290 SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserResourcesClusterMembersType & resource)
292 if (xmlHasProp(member_descr, (const xmlChar*)test_hostname))
294 xmlChar* hostname = xmlGetProp(member_descr, (const xmlChar*)test_hostname);
295 resource.HostName = (const char*)hostname;
300 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a hostname" << std::endl;
301 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
305 if (xmlHasProp(member_descr, (const xmlChar*)test_protocol))
307 xmlChar* protocol= xmlGetProp(member_descr, (const xmlChar*)test_protocol);
310 resource.Protocol = ParserResourcesType::stringToProtocol((const char *)protocol);
312 catch (SALOME_Exception e)
314 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
315 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
322 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
323 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
327 if (xmlHasProp(member_descr, (const xmlChar*)test_cluster_internal_protocol))
329 xmlChar* iprotocol= xmlGetProp(member_descr, (const xmlChar*)test_cluster_internal_protocol);
332 resource.ClusterInternalProtocol = ParserResourcesType::stringToProtocol((const char *)iprotocol);
334 catch (SALOME_Exception e)
336 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
337 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
344 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
345 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
349 if (xmlHasProp(member_descr, (const xmlChar*)test_user_name))
351 xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name);
352 resource.UserName = (const char*)user_name;
357 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a user name" << std::endl;
358 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
362 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_nodes))
364 xmlChar* nb_of_nodes = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_nodes);
365 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
366 xmlFree(nb_of_nodes);
370 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfNodes" << std::endl;
371 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
375 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node))
377 xmlChar* nb_of_proc_per_node = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node);
378 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
379 xmlFree(nb_of_proc_per_node);
383 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfProcPerNode" << std::endl;
384 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
388 if (xmlHasProp(member_descr, (const xmlChar*)test_appli_path))
390 xmlChar* appli_path = xmlGetProp(member_descr, (const xmlChar*)test_appli_path);
391 resource.AppliPath = (const char*)appli_path;
396 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a AppliPath" << std::endl;
397 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
404 SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, ParserResourcesType & resource)
406 if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
408 xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
409 resource.HostName = (const char*)hostname;
414 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning found a machine without a hostname" << std::endl;
415 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning this machine will not be added" << std::endl;
419 if (xmlHasProp(machine_descr, (const xmlChar*)test_name))
421 xmlChar* name = xmlGetProp(machine_descr, (const xmlChar*)test_name);
422 resource.Name = (const char*)name;
423 resource.DataForSort._Name = (const char*)name;
428 resource.Name = resource.HostName;
429 resource.DataForSort._Name = resource.HostName;
430 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
433 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
435 xmlChar* batch_queue = xmlGetProp(machine_descr, (const xmlChar*)test_batch_queue);
436 resource.batchQueue = (const char*)batch_queue;
437 xmlFree(batch_queue);
440 resource.batchQueue = "";
442 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_commands))
444 xmlChar* user_commands= xmlGetProp(machine_descr, (const xmlChar*)test_user_commands);
445 resource.userCommands = (const char*)user_commands;
446 xmlFree(user_commands);
449 resource.userCommands = "";
451 if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
453 xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
456 resource.Protocol = ParserResourcesType::stringToProtocol((const char *)protocol);
458 catch (SALOME_Exception e)
460 // If it'not in all theses cases, the protocol is affected to rsh
461 resource.Protocol = rsh;
466 resource.Protocol = rsh;
468 if (xmlHasProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol))
470 xmlChar* iprotocol= xmlGetProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol);
473 resource.ClusterInternalProtocol = ParserResourcesType::stringToProtocol((const char *)iprotocol);
475 catch (SALOME_Exception e)
477 // If it'not in all theses cases, the protocol is affected to rsh
478 resource.ClusterInternalProtocol = rsh;
483 resource.ClusterInternalProtocol = resource.Protocol;
485 if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
487 xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
491 resource.Mode = interactive;
494 resource.Mode = batch;
497 // If it'not in all theses cases, the mode is affected to interactive
498 resource.Mode = interactive;
504 resource.Mode = interactive;
506 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch))
508 xmlChar* batch = xmlGetProp(machine_descr, (const xmlChar*)test_batch);
509 std::string aBatch = (const char*)batch;
512 resource.Batch = pbs;
513 else if (aBatch == "lsf")
514 resource.Batch = lsf;
515 else if (aBatch == "sge")
516 resource.Batch = sge;
517 else if (aBatch == "ssh_batch")
518 resource.Batch = ssh_batch;
519 else if (aBatch == "ccc")
520 resource.Batch = ccc;
521 else if (aBatch == "slurm")
522 resource.Batch = slurm;
523 else if (aBatch == "ll")
526 resource.Batch = none;
529 if (xmlHasProp(machine_descr, (const xmlChar*)test_mpi))
531 xmlChar* mpi = xmlGetProp(machine_descr, (const xmlChar*)test_mpi);
532 std::string anMpi = (const char*)mpi;
536 else if (anMpi == "mpich1")
537 resource.mpi = mpich1;
538 else if (anMpi == "mpich2")
539 resource.mpi = mpich2;
540 else if (anMpi == "openmpi")
541 resource.mpi = openmpi;
542 else if (anMpi == "slurmmpi")
543 resource.mpi = slurmmpi;
544 else if (anMpi == "prun")
547 resource.mpi = nompi;
550 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_name))
552 xmlChar* user_name= xmlGetProp(machine_descr, (const xmlChar*)test_user_name);
553 resource.UserName = (const char*)user_name;
557 if (xmlHasProp(machine_descr, (const xmlChar*)test_appli_path))
559 xmlChar* appli_path = xmlGetProp(machine_descr, (const xmlChar*)test_appli_path);
560 resource.AppliPath = (const char*)appli_path;
564 if (xmlHasProp(machine_descr, (const xmlChar*)test_os))
566 xmlChar* os = xmlGetProp(machine_descr, (const xmlChar*)test_os);
567 resource.OS = (const char*)os;
571 if (xmlHasProp(machine_descr, (const xmlChar*)test_mem_in_mb))
573 xmlChar* mem_in_mb = xmlGetProp(machine_descr, (const xmlChar*)test_mem_in_mb);
574 resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
578 if (xmlHasProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz))
580 xmlChar* cpu_freq_mhz = xmlGetProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz);
581 resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
582 xmlFree(cpu_freq_mhz);
585 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_nodes))
587 xmlChar* nb_of_nodes = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_nodes);
588 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
589 xmlFree(nb_of_nodes);
592 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node))
594 xmlChar* nb_of_proc_per_node = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node);
595 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
596 xmlFree(nb_of_proc_per_node);
599 // Process children nodes
600 xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
601 while(aCurSubNode != NULL)
603 // Process components
604 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
606 //If a component is given, it is in a module with the same name
607 //except if the module name is given
608 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
610 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
611 std::string aComponentName = (const char*)component_name;
612 _resource.ComponentsList.push_back(aComponentName);
613 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
615 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
616 std::string aModuleName = (const char*)module_name;
617 _resource.ModulesList.push_back(aModuleName);
618 xmlFree(module_name);
621 _resource.ModulesList.push_back(aComponentName);
622 xmlFree(component_name);
626 else if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
628 // If a module is given, we create an entry in componentsList and modulesList
629 // with the same name (module == component)
630 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
632 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
633 std::string aComponentName = (const char*)component_name;
634 _resource.ComponentsList.push_back(aComponentName);
635 _resource.ModulesList.push_back(aComponentName);
636 xmlFree(component_name);
639 aCurSubNode = aCurSubNode->next;
644 //=============================================================================
646 * Fill the document tree in xml file, used to write in an xml file.
647 * \param theDoc document to fill.
649 //=============================================================================
651 void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
654 xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
656 root_node = xmlNewNode(NULL, BAD_CAST "resources");
657 xmlDocSetRootElement(theDoc, root_node);
659 std::map<std::string, ParserResourcesType>::iterator iter = _resources_list.begin();
660 for (; iter != _resources_list.end(); iter++)
662 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
663 RES_MESSAGE("Add resource name = " << (*iter).second.Name.c_str());
664 xmlNewProp(node, BAD_CAST test_name, BAD_CAST (*iter).second.Name.c_str());
665 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
666 xmlNewProp(node, BAD_CAST test_appli_path, BAD_CAST (*iter).second.AppliPath.c_str());
667 xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
668 xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
670 BAD_CAST test_protocol,
671 BAD_CAST ParserResourcesType::protocolToString((*iter).second.Protocol).c_str());
673 BAD_CAST test_cluster_internal_protocol,
674 BAD_CAST ParserResourcesType::protocolToString((*iter).second.ClusterInternalProtocol).c_str());
676 switch ((*iter).second.Mode)
679 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
682 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
685 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
688 switch ((*iter).second.Batch)
691 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
694 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
697 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
700 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ccc");
703 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "slurm");
706 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ssh_batch");
709 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ll");
712 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
715 switch ((*iter).second.mpi)
718 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
721 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
724 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
727 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
730 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurmmpi");
733 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
736 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
739 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
741 std::vector<std::string>::const_iterator iter2 = (*iter).second.ComponentsList.begin();
742 for(;iter2 != (*iter).second.ComponentsList.end(); iter2++)
744 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
745 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
748 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
749 std::ostringstream mem_stream;
750 mem_stream << (*iter).second.DataForSort._memInMB;
751 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST mem_stream.str().c_str());
752 std::ostringstream cpu_stream;
753 cpu_stream << (*iter).second.DataForSort._CPUFreqMHz;
754 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST cpu_stream.str().c_str());
755 std::ostringstream nb_nodes_stream;
756 nb_nodes_stream << (*iter).second.DataForSort._nbOfNodes;
757 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST nb_nodes_stream.str().c_str());
758 std::ostringstream nb_proc_per_nodes_stream;
759 nb_proc_per_nodes_stream << (*iter).second.DataForSort._nbOfProcPerNode;
760 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST nb_proc_per_nodes_stream.str().c_str());