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"
35 //=============================================================================
38 * \param listOfResources: map of ParserResourcesType to fill when parsing
40 //=============================================================================
42 SALOME_ResourcesCatalog_Handler::
43 SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list,
44 MapOfParserResourcesType& resources_batch_list):
45 _resources_list(resources_list),
46 _resources_batch_list(resources_batch_list)
48 //XML tags initialisation
49 test_machine = "machine";
50 test_cluster = "cluster";
51 test_hostname = "hostname";
53 test_protocol = "protocol";
57 test_user_name = "userName";
58 test_appli_path = "appliPath";
59 test_modules = "modules";
60 test_module_name = "moduleName";
61 test_components = "component";
62 test_component_name = "name";
64 test_mem_in_mb = "memInMB";
65 test_cpu_freq_mhz = "CPUFreqMHz";
66 test_nb_of_nodes = "nbOfNodes";
67 test_nb_of_proc = "nbOfProc";
68 test_nb_of_proc_per_node = "nbOfProcPerNode";
69 test_batch_queue = "batchQueue";
70 test_user_commands = "userCommands";
72 test_members = "members";
75 //=============================================================================
79 //=============================================================================
81 SALOME_ResourcesCatalog_Handler::~SALOME_ResourcesCatalog_Handler()
83 // cout << "SALOME_ResourcesCatalog_Handler destruction") << endl;
86 //=============================================================================
88 * Retrieves DS after the file parse.
90 //=============================================================================
92 const MapOfParserResourcesType&
93 SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const
95 return _resources_list;
98 //=============================================================================
100 * Processes XML document and fills the list of resources
102 //=============================================================================
104 void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
106 // Empty private elements
107 _resources_list.clear();
109 // Get the document root node
110 xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
112 aCurNode = aCurNode->xmlChildrenNode;
114 // Processing the document nodes
115 while(aCurNode != NULL)
117 // Cas d'une machine ou d'une machine batch
118 if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine) )
121 bool Ok = ProcessMachine(aCurNode, _resource);
124 // There is two lists
125 // _resources_list for interactive resources
126 // _resources_batch_list for batch resources
127 // This choice is done with Mode parameter
128 if (_resource.Mode == interactive)
130 // Adding a generic cluster
131 int aNbNodes = _resource.DataForSort._nbOfNodes;
133 string clusterNode = _resource.DataForSort._hostName ;
134 for( int i=0; i < aNbNodes; i++ ){
137 sprintf(inode,"%s%d",clusterNode.c_str(),i+1);
138 std::string nodeName(inode);
139 _resource.DataForSort._hostName = nodeName ;
140 _resource.HostName = nodeName ;
141 _resources_list[nodeName] = _resource;
147 _resources_list[_resource.HostName] = _resource;
148 if(_resource.HostName == "localhost")
150 _resource.HostName = Kernel_Utils::GetHostname();
151 _resource.DataForSort._hostName = Kernel_Utils::GetHostname();
152 _resources_list[Kernel_Utils::GetHostname()] = _resource;
157 // Adding a batch machine/cluster
158 _resources_batch_list[_resource.HostName] = _resource;
161 if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster) )
163 // Cas de la déclaration d'un cluster
165 if(ProcessCluster(aCurNode, _resource))
166 _resources_list[_resource.HostName] = _resource;
168 aCurNode = aCurNode->next;
172 for (map<string, ParserResourcesType>::const_iterator iter = _resources_list.begin();
173 iter != _resources_list.end();
176 std::cerr << (*iter).first << std::endl;
177 std::cerr << (*iter).second.HostName << std::endl;
178 std::cerr << (*iter).second.Alias << std::endl;
179 std::cerr << (*iter).second.UserName << std::endl;
180 std::cerr << (*iter).second.AppliPath << std::endl;
181 std::cerr << (*iter).second.OS << std::endl;
182 std::cerr << (*iter).second.Protocol << std::endl;
183 std::cerr << (*iter).second.Mode << std::endl;
190 SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, ParserResourcesType & resource)
192 // Ajout d'un cluster
193 // hostname, use et nbOfProc sont obligatoires
194 if (xmlHasProp(cluster_descr, (const xmlChar*)test_hostname))
196 xmlChar* hostname = xmlGetProp(cluster_descr, (const xmlChar*)test_hostname);
197 resource.DataForSort._hostName = (const char*)hostname;
198 resource.HostName = (const char*)hostname;
203 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a hostname" << std::endl;
204 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << 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.DataForSort._hostName = (const char*)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_user_name))
331 xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name);
332 resource.UserName = (const char*)user_name;
337 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a user name" << std::endl;
338 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
342 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_nodes))
344 xmlChar* nb_of_nodes = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_nodes);
345 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
346 xmlFree(nb_of_nodes);
350 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfNodes" << std::endl;
351 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
355 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node))
357 xmlChar* nb_of_proc_per_node = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node);
358 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
359 xmlFree(nb_of_proc_per_node);
363 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfProcPerNode" << std::endl;
364 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
368 if (xmlHasProp(member_descr, (const xmlChar*)test_appli_path))
370 xmlChar* appli_path = xmlGetProp(member_descr, (const xmlChar*)test_appli_path);
371 resource.AppliPath = (const char*)appli_path;
376 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a AppliPath" << std::endl;
377 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
384 SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, ParserResourcesType & resource)
386 if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
388 xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
389 resource.DataForSort._hostName = (const char*)hostname;
390 resource.HostName = (const char*)hostname;
395 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning found a machine without a hostname" << std::endl;
396 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning this machine will not be added" << std::endl;
400 if (xmlHasProp(machine_descr, (const xmlChar*)test_alias))
402 xmlChar* alias = xmlGetProp(machine_descr, (const xmlChar*)test_alias);
403 resource.Alias = (const char*)alias;
409 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
411 xmlChar* batch_queue = xmlGetProp(machine_descr, (const xmlChar*)test_batch_queue);
412 resource.batchQueue = (const char*)batch_queue;
413 xmlFree(batch_queue);
416 resource.batchQueue = "";
418 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_commands))
420 xmlChar* user_commands= xmlGetProp(machine_descr, (const xmlChar*)test_user_commands);
421 resource.userCommands = (const char*)user_commands;
422 xmlFree(user_commands);
425 resource.userCommands = "";
427 if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
429 xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
430 switch ( protocol[0])
433 resource.Protocol = rsh;
436 resource.Protocol = ssh;
439 // If it'not in all theses cases, the protocol is affected to rsh
440 resource.Protocol = rsh;
446 resource.Protocol = rsh;
448 if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
450 xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
454 resource.Mode = interactive;
457 resource.Mode = batch;
460 // If it'not in all theses cases, the mode is affected to interactive
461 resource.Mode = interactive;
467 resource.Mode = interactive;
469 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch))
471 xmlChar* batch = xmlGetProp(machine_descr, (const xmlChar*)test_batch);
472 std::string aBatch = (const char*)batch;
475 resource.Batch = pbs;
476 else if (aBatch == "lsf")
477 resource.Batch = lsf;
478 else if (aBatch == "sge")
479 resource.Batch = sge;
481 resource.Batch = none;
484 if (xmlHasProp(machine_descr, (const xmlChar*)test_mpi))
486 xmlChar* mpi = xmlGetProp(machine_descr, (const xmlChar*)test_mpi);
487 std::string anMpi = (const char*)mpi;
491 else if (anMpi == "mpich1")
492 resource.mpi = mpich1;
493 else if (anMpi == "mpich2")
494 resource.mpi = mpich2;
495 else if (anMpi == "openmpi")
496 resource.mpi = openmpi;
497 else if (anMpi == "slurm")
498 resource.mpi = slurm;
499 else if (anMpi == "prun")
502 resource.mpi = nompi;
505 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_name))
507 xmlChar* user_name= xmlGetProp(machine_descr, (const xmlChar*)test_user_name);
508 resource.UserName = (const char*)user_name;
512 if (xmlHasProp(machine_descr, (const xmlChar*)test_appli_path))
514 xmlChar* appli_path = xmlGetProp(machine_descr, (const xmlChar*)test_appli_path);
515 resource.AppliPath = (const char*)appli_path;
519 if (xmlHasProp(machine_descr, (const xmlChar*)test_os))
521 xmlChar* os = xmlGetProp(machine_descr, (const xmlChar*)test_os);
522 resource.OS = (const char*)os;
526 if (xmlHasProp(machine_descr, (const xmlChar*)test_mem_in_mb))
528 xmlChar* mem_in_mb = xmlGetProp(machine_descr, (const xmlChar*)test_mem_in_mb);
529 resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
533 if (xmlHasProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz))
535 xmlChar* cpu_freq_mhz = xmlGetProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz);
536 resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
537 xmlFree(cpu_freq_mhz);
540 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_nodes))
542 xmlChar* nb_of_nodes = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_nodes);
543 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
544 xmlFree(nb_of_nodes);
547 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node))
549 xmlChar* nb_of_proc_per_node = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node);
550 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
551 xmlFree(nb_of_proc_per_node);
554 // Process children nodes
555 xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
556 while(aCurSubNode != NULL)
558 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
560 //If a component is given, it is in a module with the same name
561 //except if the module name is given
562 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
564 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
565 std::string aComponentName = (const char*)component_name;
566 _resource.ComponentsList.push_back(aComponentName);
567 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
569 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
570 std::string aModuleName = (const char*)module_name;
571 _resource.ModulesList.push_back(aModuleName);
572 xmlFree(module_name);
575 _resource.ModulesList.push_back(aComponentName);
576 xmlFree(component_name);
580 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
582 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
584 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
585 std::string aModuleName = (const char*)module_name;
586 resource.ModulesList.push_back(aModuleName);
587 xmlFree(module_name);
590 aCurSubNode = aCurSubNode->next;
595 //=============================================================================
597 * Fill the document tree in xml file, used to write in an xml file.
598 * \param theDoc document to fill.
600 //=============================================================================
602 void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
605 xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
608 root_node = xmlNewNode(NULL, BAD_CAST "resources");
609 xmlDocSetRootElement(theDoc, root_node);
611 for (map<string, ParserResourcesType>::iterator iter =
612 _resources_list.begin();
613 iter != _resources_list.end();
616 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
617 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
618 xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
619 xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
620 xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
622 switch ((*iter).second.Protocol)
625 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
628 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
631 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
634 switch ((*iter).second.Mode)
637 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
640 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
643 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
646 switch ((*iter).second.Batch)
649 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
652 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
655 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
658 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
661 switch ((*iter).second.mpi)
664 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
667 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
670 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
673 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
676 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
679 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
682 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
685 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
687 for (vector<string>::const_iterator iter2 =
688 (*iter).second.ComponentsList.begin();
689 iter2 != (*iter).second.ComponentsList.end();
692 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
693 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
696 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
697 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
698 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
699 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
700 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));
702 for (map<string, ParserResourcesType>::iterator iter =
703 _resources_batch_list.begin();
704 iter != _resources_batch_list.end();
707 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
708 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
709 xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
711 switch ((*iter).second.Protocol)
714 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
717 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
720 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
723 switch ((*iter).second.Mode)
726 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
729 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
732 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
735 switch ((*iter).second.Batch)
738 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
741 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
744 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
747 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
750 switch ((*iter).second.mpi)
753 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
756 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
759 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
762 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
765 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
768 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
771 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
774 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
776 for (vector<string>::const_iterator iter2 =
777 (*iter).second.ComponentsList.begin();
778 iter2 != (*iter).second.ComponentsList.end();
781 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
782 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
785 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
786 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
787 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
788 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
789 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));