1 // Copyright (C) 2007-2008 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
22 // SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
23 // File : SALOME_ResourcesCatalog_Handler.cxx
24 // Author : Estelle Deville
28 #include "SALOME_ResourcesCatalog_Handler.hxx"
29 #include "Basics_Utils.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();
108 // Get the document root node
109 xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
111 aCurNode = aCurNode->xmlChildrenNode;
113 // Processing the document nodes
114 while(aCurNode != NULL)
116 // Cas d'une machine ou d'une machine batch
117 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine))
120 bool Ok = ProcessMachine(aCurNode, _resource);
124 if(_resource.HostName == "localhost")
126 _resource.HostName = Kernel_Utils::GetHostname();
127 if (_resource.Name == "localhost")
129 _resource.Name = Kernel_Utils::GetHostname();
130 _resource.DataForSort._Name = Kernel_Utils::GetHostname();
133 map<string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
134 if (iter != _resources_list.end())
135 RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
136 _resources_list[_resource.Name] = _resource;
139 // Cas de la déclaration d'un cluster
140 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster))
143 if(ProcessCluster(aCurNode, _resource))
145 map<string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
146 if (iter != _resources_list.end())
147 RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
148 _resources_list[_resource.Name] = _resource;
151 aCurNode = aCurNode->next;
155 for (map<string, ParserResourcesType>::const_iterator iter = _resources_list.begin();
156 iter != _resources_list.end();
159 std::cerr << "************************************************" << std::endl;
160 std::cerr << "Resource " << (*iter).first << " found:" << std::endl;
161 std::cerr << " Name: " << (*iter).second.Name << std::endl;
162 std::cerr << " Hostname: " << (*iter).second.HostName << std::endl;
163 std::cerr << " Username: " << (*iter).second.UserName << std::endl;
164 std::cerr << " Appli path: " <<(*iter).second.AppliPath << std::endl;
165 std::cerr << " OS: " << (*iter).second.OS << std::endl;
166 std::cerr << " Protocol: " << (*iter).second.PrintAccessProtocolType() << std::endl;
167 std::cerr << " Internal Protocol: " <<(*iter).second.PrintClusterInternalProtocol() << std::endl;
168 std::cerr << " Mode: " << (*iter).second.PrintAccessModeType() << std::endl;
169 std::cerr << " Batch Type: " << (*iter).second.PrintBatchType() << std::endl;
170 std::cerr << " MPI Impl: " << (*iter).second.PrintMpiImplType() << std::endl;
171 std::cerr << "************************************************" << std::endl;
177 SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, ParserResourcesType & resource)
179 // Ajout d'un cluster
180 // hostname, use et nbOfProc sont obligatoires
181 if (xmlHasProp(cluster_descr, (const xmlChar*)test_hostname))
183 xmlChar* hostname = xmlGetProp(cluster_descr, (const xmlChar*)test_hostname);
184 resource.HostName = (const char*)hostname;
189 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a hostname" << std::endl;
190 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
194 if (xmlHasProp(cluster_descr, (const xmlChar*)test_name))
196 xmlChar* name = xmlGetProp(cluster_descr, (const xmlChar*)test_name);
197 resource.Name = (const char*)name;
198 resource.DataForSort._Name = (const char*)name;
203 resource.Name = resource.HostName;
204 resource.DataForSort._Name = resource.HostName;
205 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
208 if (xmlHasProp(cluster_descr, (const xmlChar*)test_use))
210 xmlChar* use = xmlGetProp(cluster_descr, (const xmlChar*)test_use);
211 resource.use = (const char*)use;
216 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a use" << std::endl;
217 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
221 if (xmlHasProp(cluster_descr, (const xmlChar*)test_nb_of_proc))
223 xmlChar* nb_of_proc = xmlGetProp(cluster_descr, (const xmlChar*)test_nb_of_proc);
224 resource.nbOfProc = atoi((const char*)nb_of_proc);
229 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a nbOfProc" << std::endl;
230 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
234 if (xmlHasProp(cluster_descr, (const xmlChar*)test_mpi))
236 xmlChar* mpi = xmlGetProp(cluster_descr, (const xmlChar*)test_mpi);
237 std::string anMpi = (const char*)mpi;
241 else if (anMpi == "mpich1")
242 resource.mpi = mpich1;
243 else if (anMpi == "mpich2")
244 resource.mpi = mpich2;
245 else if (anMpi == "openmpi")
246 resource.mpi = openmpi;
247 else if (anMpi == "slurm")
248 resource.mpi = slurm;
249 else if (anMpi == "prun")
252 resource.mpi = nompi;
255 // Parsing des membres du cluster
256 xmlNodePtr aCurSubNode = cluster_descr->xmlChildrenNode;
257 while(aCurSubNode != NULL)
259 if (!xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_members))
261 xmlNodePtr members = aCurSubNode->xmlChildrenNode;
262 while (members != NULL)
265 if (!xmlStrcmp(members->name, (const xmlChar*)test_machine))
267 ParserResourcesClusterMembersType new_member;
268 if (ProcessMember(members, new_member))
269 resource.ClusterMembersList.push_back(new_member);
271 members = members->next;
274 aCurSubNode = aCurSubNode->next;
277 // Test: Il faut au moins un membre pour que le cluster soit correct !
278 if (resource.ClusterMembersList.empty())
280 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a member" << std::endl;
281 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
288 SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserResourcesClusterMembersType & resource)
290 if (xmlHasProp(member_descr, (const xmlChar*)test_hostname))
292 xmlChar* hostname = xmlGetProp(member_descr, (const xmlChar*)test_hostname);
293 resource.HostName = (const char*)hostname;
298 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a hostname" << std::endl;
299 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
303 if (xmlHasProp(member_descr, (const xmlChar*)test_protocol))
305 xmlChar* protocol= xmlGetProp(member_descr, (const xmlChar*)test_protocol);
309 resource.Protocol = rsh;
312 resource.Protocol = ssh;
315 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
316 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
323 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
324 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
328 if (xmlHasProp(member_descr, (const xmlChar*)test_cluster_internal_protocol))
330 xmlChar* iprotocol= xmlGetProp(member_descr, (const xmlChar*)test_cluster_internal_protocol);
331 switch (iprotocol[0])
334 resource.ClusterInternalProtocol = rsh;
337 resource.ClusterInternalProtocol = ssh;
340 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
341 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
348 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
349 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
353 if (xmlHasProp(member_descr, (const xmlChar*)test_user_name))
355 xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name);
356 resource.UserName = (const char*)user_name;
361 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a user name" << std::endl;
362 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
366 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_nodes))
368 xmlChar* nb_of_nodes = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_nodes);
369 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
370 xmlFree(nb_of_nodes);
374 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfNodes" << std::endl;
375 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
379 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node))
381 xmlChar* nb_of_proc_per_node = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node);
382 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
383 xmlFree(nb_of_proc_per_node);
387 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfProcPerNode" << std::endl;
388 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
392 if (xmlHasProp(member_descr, (const xmlChar*)test_appli_path))
394 xmlChar* appli_path = xmlGetProp(member_descr, (const xmlChar*)test_appli_path);
395 resource.AppliPath = (const char*)appli_path;
400 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a AppliPath" << std::endl;
401 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
408 SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, ParserResourcesType & resource)
410 if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
412 xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
413 resource.HostName = (const char*)hostname;
418 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning found a machine without a hostname" << std::endl;
419 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning this machine will not be added" << std::endl;
423 if (xmlHasProp(machine_descr, (const xmlChar*)test_name))
425 xmlChar* name = xmlGetProp(machine_descr, (const xmlChar*)test_name);
426 resource.Name = (const char*)name;
427 resource.DataForSort._Name = (const char*)name;
432 resource.Name = resource.HostName;
433 resource.DataForSort._Name = resource.HostName;
434 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
437 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
439 xmlChar* batch_queue = xmlGetProp(machine_descr, (const xmlChar*)test_batch_queue);
440 resource.batchQueue = (const char*)batch_queue;
441 xmlFree(batch_queue);
444 resource.batchQueue = "";
446 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_commands))
448 xmlChar* user_commands= xmlGetProp(machine_descr, (const xmlChar*)test_user_commands);
449 resource.userCommands = (const char*)user_commands;
450 xmlFree(user_commands);
453 resource.userCommands = "";
455 if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
457 xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
458 switch ( protocol[0])
461 resource.Protocol = rsh;
464 resource.Protocol = ssh;
467 // If it'not in all theses cases, the protocol is affected to rsh
468 resource.Protocol = rsh;
474 resource.Protocol = rsh;
476 if (xmlHasProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol))
478 xmlChar* iprotocol= xmlGetProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol);
479 switch ( iprotocol[0])
482 resource.ClusterInternalProtocol = rsh;
485 resource.ClusterInternalProtocol = ssh;
488 // If it'not in all theses cases, the protocol is affected to rsh
489 resource.ClusterInternalProtocol = rsh;
495 resource.ClusterInternalProtocol = resource.Protocol;
497 if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
499 xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
503 resource.Mode = interactive;
506 resource.Mode = batch;
509 // If it'not in all theses cases, the mode is affected to interactive
510 resource.Mode = interactive;
516 resource.Mode = interactive;
518 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch))
520 xmlChar* batch = xmlGetProp(machine_descr, (const xmlChar*)test_batch);
521 std::string aBatch = (const char*)batch;
524 resource.Batch = pbs;
525 else if (aBatch == "lsf")
526 resource.Batch = lsf;
527 else if (aBatch == "sge")
528 resource.Batch = sge;
529 else if (aBatch == "ssh_batch")
530 resource.Batch = ssh_batch;
532 resource.Batch = none;
535 if (xmlHasProp(machine_descr, (const xmlChar*)test_mpi))
537 xmlChar* mpi = xmlGetProp(machine_descr, (const xmlChar*)test_mpi);
538 std::string anMpi = (const char*)mpi;
542 else if (anMpi == "mpich1")
543 resource.mpi = mpich1;
544 else if (anMpi == "mpich2")
545 resource.mpi = mpich2;
546 else if (anMpi == "openmpi")
547 resource.mpi = openmpi;
548 else if (anMpi == "slurm")
549 resource.mpi = slurm;
550 else if (anMpi == "prun")
553 resource.mpi = nompi;
556 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_name))
558 xmlChar* user_name= xmlGetProp(machine_descr, (const xmlChar*)test_user_name);
559 resource.UserName = (const char*)user_name;
563 if (xmlHasProp(machine_descr, (const xmlChar*)test_appli_path))
565 xmlChar* appli_path = xmlGetProp(machine_descr, (const xmlChar*)test_appli_path);
566 resource.AppliPath = (const char*)appli_path;
570 if (xmlHasProp(machine_descr, (const xmlChar*)test_os))
572 xmlChar* os = xmlGetProp(machine_descr, (const xmlChar*)test_os);
573 resource.OS = (const char*)os;
577 if (xmlHasProp(machine_descr, (const xmlChar*)test_mem_in_mb))
579 xmlChar* mem_in_mb = xmlGetProp(machine_descr, (const xmlChar*)test_mem_in_mb);
580 resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
584 if (xmlHasProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz))
586 xmlChar* cpu_freq_mhz = xmlGetProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz);
587 resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
588 xmlFree(cpu_freq_mhz);
591 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_nodes))
593 xmlChar* nb_of_nodes = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_nodes);
594 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
595 xmlFree(nb_of_nodes);
598 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node))
600 xmlChar* nb_of_proc_per_node = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node);
601 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
602 xmlFree(nb_of_proc_per_node);
605 // Process children nodes
606 xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
607 while(aCurSubNode != NULL)
609 // Process components
610 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
612 //If a component is given, it is in a module with the same name
613 //except if the module name is given
614 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
616 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
617 std::string aComponentName = (const char*)component_name;
618 _resource.ComponentsList.push_back(aComponentName);
619 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
621 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
622 std::string aModuleName = (const char*)module_name;
623 _resource.ModulesList.push_back(aModuleName);
624 xmlFree(module_name);
627 _resource.ModulesList.push_back(aComponentName);
628 xmlFree(component_name);
632 else if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
634 // If a module is given, we create an entry in componentsList and modulesList
635 // with the same name (module == component)
636 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
638 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
639 std::string aComponentName = (const char*)component_name;
640 _resource.ComponentsList.push_back(aComponentName);
641 _resource.ModulesList.push_back(aComponentName);
642 xmlFree(component_name);
645 aCurSubNode = aCurSubNode->next;
650 //=============================================================================
652 * Fill the document tree in xml file, used to write in an xml file.
653 * \param theDoc document to fill.
655 //=============================================================================
657 void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
660 xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
662 root_node = xmlNewNode(NULL, BAD_CAST "resources");
663 xmlDocSetRootElement(theDoc, root_node);
665 std::map<std::string, ParserResourcesType>::iterator iter = _resources_list.begin();
666 for (; iter != _resources_list.end(); iter++)
668 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
669 RES_MESSAGE("Add resource name = " << (*iter).second.Name.c_str());
670 xmlNewProp(node, BAD_CAST test_name, BAD_CAST (*iter).second.Name.c_str());
671 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
672 xmlNewProp(node, BAD_CAST test_appli_path, BAD_CAST (*iter).second.AppliPath.c_str());
673 xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
674 xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
676 switch ((*iter).second.Protocol)
679 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
682 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
685 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
688 switch ((*iter).second.ClusterInternalProtocol)
691 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
694 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "ssh");
697 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
700 switch ((*iter).second.Mode)
703 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
706 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
709 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
712 switch ((*iter).second.Batch)
715 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
718 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
721 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
724 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ssh_batch");
727 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
730 switch ((*iter).second.mpi)
733 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
736 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
739 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
742 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
745 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
748 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
751 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
754 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
756 std::vector<std::string>::const_iterator iter2 = (*iter).second.ComponentsList.begin();
757 for(;iter2 != (*iter).second.ComponentsList.end(); iter2++)
759 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
760 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
763 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
764 std::ostringstream mem_stream;
765 mem_stream << (*iter).second.DataForSort._memInMB;
766 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST mem_stream.str().c_str());
767 std::ostringstream cpu_stream;
768 cpu_stream << (*iter).second.DataForSort._CPUFreqMHz;
769 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST cpu_stream.str().c_str());
770 std::ostringstream nb_nodes_stream;
771 nb_nodes_stream << (*iter).second.DataForSort._nbOfNodes;
772 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST nb_nodes_stream.str().c_str());
773 std::ostringstream nb_proc_per_nodes_stream;
774 nb_proc_per_nodes_stream << (*iter).second.DataForSort._nbOfProcPerNode;
775 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST nb_proc_per_nodes_stream.str().c_str());