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;
383 SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, ParserResourcesType & resource)
385 if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
387 xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
388 resource.DataForSort._hostName = (const char*)hostname;
389 resource.HostName = (const char*)hostname;
394 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning found a machine without a hostname" << std::endl;
395 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning this machine will not be added" << std::endl;
399 if (xmlHasProp(machine_descr, (const xmlChar*)test_alias))
401 xmlChar* alias = xmlGetProp(machine_descr, (const xmlChar*)test_alias);
402 resource.Alias = (const char*)alias;
408 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
410 xmlChar* batch_queue = xmlGetProp(machine_descr, (const xmlChar*)test_batch_queue);
411 resource.batchQueue = (const char*)batch_queue;
412 xmlFree(batch_queue);
415 resource.batchQueue = "";
417 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_commands))
419 xmlChar* user_commands= xmlGetProp(machine_descr, (const xmlChar*)test_user_commands);
420 resource.userCommands = (const char*)user_commands;
421 xmlFree(user_commands);
424 resource.userCommands = "";
426 if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
428 xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
429 switch ( protocol[0])
432 resource.Protocol = rsh;
435 resource.Protocol = ssh;
438 // If it'not in all theses cases, the protocol is affected to rsh
439 resource.Protocol = rsh;
445 resource.Protocol = rsh;
447 if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
449 xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
453 resource.Mode = interactive;
456 resource.Mode = batch;
459 // If it'not in all theses cases, the mode is affected to interactive
460 resource.Mode = interactive;
466 resource.Mode = interactive;
468 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch))
470 xmlChar* batch = xmlGetProp(machine_descr, (const xmlChar*)test_batch);
471 std::string aBatch = (const char*)batch;
474 resource.Batch = pbs;
475 else if (aBatch == "lsf")
476 resource.Batch = lsf;
477 else if (aBatch == "sge")
478 resource.Batch = sge;
480 resource.Batch = none;
483 if (xmlHasProp(machine_descr, (const xmlChar*)test_mpi))
485 xmlChar* mpi = xmlGetProp(machine_descr, (const xmlChar*)test_mpi);
486 std::string anMpi = (const char*)mpi;
490 else if (anMpi == "mpich1")
491 resource.mpi = mpich1;
492 else if (anMpi == "mpich2")
493 resource.mpi = mpich2;
494 else if (anMpi == "openmpi")
495 resource.mpi = openmpi;
496 else if (anMpi == "slurm")
497 resource.mpi = slurm;
498 else if (anMpi == "prun")
501 resource.mpi = nompi;
504 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_name))
506 xmlChar* user_name= xmlGetProp(machine_descr, (const xmlChar*)test_user_name);
507 resource.UserName = (const char*)user_name;
511 if (xmlHasProp(machine_descr, (const xmlChar*)test_appli_path))
513 xmlChar* appli_path = xmlGetProp(machine_descr, (const xmlChar*)test_appli_path);
514 resource.AppliPath = (const char*)appli_path;
518 if (xmlHasProp(machine_descr, (const xmlChar*)test_os))
520 xmlChar* os = xmlGetProp(machine_descr, (const xmlChar*)test_os);
521 resource.OS = (const char*)os;
525 if (xmlHasProp(machine_descr, (const xmlChar*)test_mem_in_mb))
527 xmlChar* mem_in_mb = xmlGetProp(machine_descr, (const xmlChar*)test_mem_in_mb);
528 resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
532 if (xmlHasProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz))
534 xmlChar* cpu_freq_mhz = xmlGetProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz);
535 resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
536 xmlFree(cpu_freq_mhz);
539 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_nodes))
541 xmlChar* nb_of_nodes = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_nodes);
542 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
543 xmlFree(nb_of_nodes);
546 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node))
548 xmlChar* nb_of_proc_per_node = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node);
549 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
550 xmlFree(nb_of_proc_per_node);
553 // Process children nodes
554 xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
555 while(aCurSubNode != NULL)
557 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
559 //If a component is given, it is in a module with the same name
560 //except if the module name is given
561 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
563 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
564 std::string aComponentName = (const char*)component_name;
565 _resource.ComponentsList.push_back(aComponentName);
566 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
568 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
569 std::string aModuleName = (const char*)module_name;
570 _resource.ModulesList.push_back(aModuleName);
571 xmlFree(module_name);
574 _resource.ModulesList.push_back(aComponentName);
575 xmlFree(component_name);
579 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
581 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
583 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
584 std::string aModuleName = (const char*)module_name;
585 resource.ModulesList.push_back(aModuleName);
586 xmlFree(module_name);
589 aCurSubNode = aCurSubNode->next;
594 //=============================================================================
596 * Fill the document tree in xml file, used to write in an xml file.
597 * \param theDoc document to fill.
599 //=============================================================================
601 void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
604 xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
607 root_node = xmlNewNode(NULL, BAD_CAST "resources");
608 xmlDocSetRootElement(theDoc, root_node);
610 for (map<string, ParserResourcesType>::iterator iter =
611 _resources_list.begin();
612 iter != _resources_list.end();
615 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
616 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
617 xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
618 xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
619 xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
621 switch ((*iter).second.Protocol)
624 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
627 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
630 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
633 switch ((*iter).second.Mode)
636 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
639 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
642 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
645 switch ((*iter).second.Batch)
648 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
651 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
654 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
657 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
660 switch ((*iter).second.mpi)
663 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
666 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
669 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
672 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
675 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
678 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
681 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
684 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
686 for (vector<string>::const_iterator iter2 =
687 (*iter).second.ComponentsList.begin();
688 iter2 != (*iter).second.ComponentsList.end();
691 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
692 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
695 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
696 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
697 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
698 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
699 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));
701 for (map<string, ParserResourcesType>::iterator iter =
702 _resources_batch_list.begin();
703 iter != _resources_batch_list.end();
706 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
707 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
708 xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
710 switch ((*iter).second.Protocol)
713 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
716 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
719 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
722 switch ((*iter).second.Mode)
725 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
728 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
731 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
734 switch ((*iter).second.Batch)
737 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
740 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
743 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
746 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
749 switch ((*iter).second.mpi)
752 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
755 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
758 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
761 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
764 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
767 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
770 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
773 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
775 for (vector<string>::const_iterator iter2 =
776 (*iter).second.ComponentsList.begin();
777 iter2 != (*iter).second.ComponentsList.end();
780 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
781 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
784 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
785 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
786 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
787 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
788 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));