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 if(_resource.HostName == "localhost")
149 _resource.HostName = Kernel_Utils::GetHostname();
150 _resource.DataForSort._hostName = Kernel_Utils::GetHostname();
151 _resources_list[Kernel_Utils::GetHostname()] = _resource;
154 _resources_list[_resource.HostName] = _resource;
158 // Adding a batch machine/cluster
159 _resources_batch_list[_resource.HostName] = _resource;
162 if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster) )
164 // Cas de la déclaration d'un cluster
166 if(ProcessCluster(aCurNode, _resource))
167 _resources_list[_resource.HostName] = _resource;
169 aCurNode = aCurNode->next;
173 for (map<string, ParserResourcesType>::const_iterator iter = _resources_list.begin();
174 iter != _resources_list.end();
177 std::cerr << (*iter).first << std::endl;
178 std::cerr << (*iter).second.HostName << std::endl;
179 std::cerr << (*iter).second.Alias << std::endl;
180 std::cerr << (*iter).second.UserName << std::endl;
181 std::cerr << (*iter).second.AppliPath << std::endl;
182 std::cerr << (*iter).second.OS << std::endl;
183 std::cerr << (*iter).second.Protocol << std::endl;
184 std::cerr << (*iter).second.Mode << std::endl;
191 SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, ParserResourcesType & resource)
193 // Ajout d'un cluster
194 // hostname, use et nbOfProc sont obligatoires
195 if (xmlHasProp(cluster_descr, (const xmlChar*)test_hostname))
197 xmlChar* hostname = xmlGetProp(cluster_descr, (const xmlChar*)test_hostname);
198 resource.DataForSort._hostName = (const char*)hostname;
199 resource.HostName = (const char*)hostname;
204 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a hostname" << std::endl;
205 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
209 if (xmlHasProp(cluster_descr, (const xmlChar*)test_use))
211 xmlChar* use = xmlGetProp(cluster_descr, (const xmlChar*)test_use);
212 resource.use = (const char*)use;
217 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a use" << std::endl;
218 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
222 if (xmlHasProp(cluster_descr, (const xmlChar*)test_nb_of_proc))
224 xmlChar* nb_of_proc = xmlGetProp(cluster_descr, (const xmlChar*)test_nb_of_proc);
225 resource.nbOfProc = atoi((const char*)nb_of_proc);
230 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a nbOfProc" << std::endl;
231 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
235 if (xmlHasProp(cluster_descr, (const xmlChar*)test_mpi))
237 xmlChar* mpi = xmlGetProp(cluster_descr, (const xmlChar*)test_mpi);
238 std::string anMpi = (const char*)mpi;
242 else if (anMpi == "mpich1")
243 resource.mpi = mpich1;
244 else if (anMpi == "mpich2")
245 resource.mpi = mpich2;
246 else if (anMpi == "openmpi")
247 resource.mpi = openmpi;
248 else if (anMpi == "slurm")
249 resource.mpi = slurm;
250 else if (anMpi == "prun")
253 resource.mpi = nompi;
256 // Parsing des membres du cluster
257 xmlNodePtr aCurSubNode = cluster_descr->xmlChildrenNode;
258 while(aCurSubNode != NULL)
260 if (!xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_members))
262 xmlNodePtr members = aCurSubNode->xmlChildrenNode;
263 while (members != NULL)
266 if (!xmlStrcmp(members->name, (const xmlChar*)test_machine))
268 ParserResourcesClusterMembersType new_member;
269 if (ProcessMember(members, new_member))
270 resource.ClusterMembersList.push_back(new_member);
272 members = members->next;
275 aCurSubNode = aCurSubNode->next;
278 // Test: Il faut au moins un membre pour que le cluster soit correct !
279 if (resource.ClusterMembersList.empty())
281 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a member" << std::endl;
282 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
289 SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserResourcesClusterMembersType & resource)
291 if (xmlHasProp(member_descr, (const xmlChar*)test_hostname))
293 xmlChar* hostname = xmlGetProp(member_descr, (const xmlChar*)test_hostname);
294 resource.DataForSort._hostName = (const char*)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);
311 resource.Protocol = rsh;
314 resource.Protocol = ssh;
317 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
318 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
325 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
326 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
330 if (xmlHasProp(member_descr, (const xmlChar*)test_user_name))
332 xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name);
333 resource.UserName = (const char*)user_name;
338 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a user name" << std::endl;
339 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
343 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_nodes))
345 xmlChar* nb_of_nodes = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_nodes);
346 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
347 xmlFree(nb_of_nodes);
351 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfNodes" << std::endl;
352 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
356 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node))
358 xmlChar* nb_of_proc_per_node = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node);
359 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
360 xmlFree(nb_of_proc_per_node);
364 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfProcPerNode" << std::endl;
365 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
369 if (xmlHasProp(member_descr, (const xmlChar*)test_appli_path))
371 xmlChar* appli_path = xmlGetProp(member_descr, (const xmlChar*)test_appli_path);
372 resource.AppliPath = (const char*)appli_path;
377 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a AppliPath" << std::endl;
378 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
385 SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, ParserResourcesType & resource)
387 if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
389 xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
390 resource.DataForSort._hostName = (const char*)hostname;
391 resource.HostName = (const char*)hostname;
396 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning found a machine without a hostname" << std::endl;
397 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning this machine will not be added" << std::endl;
401 if (xmlHasProp(machine_descr, (const xmlChar*)test_alias))
403 xmlChar* alias = xmlGetProp(machine_descr, (const xmlChar*)test_alias);
404 resource.Alias = (const char*)alias;
410 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
412 xmlChar* batch_queue = xmlGetProp(machine_descr, (const xmlChar*)test_batch_queue);
413 resource.batchQueue = (const char*)batch_queue;
414 xmlFree(batch_queue);
417 resource.batchQueue = "";
419 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_commands))
421 xmlChar* user_commands= xmlGetProp(machine_descr, (const xmlChar*)test_user_commands);
422 resource.userCommands = (const char*)user_commands;
423 xmlFree(user_commands);
426 resource.userCommands = "";
428 if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
430 xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
431 switch ( protocol[0])
434 resource.Protocol = rsh;
437 resource.Protocol = ssh;
440 // If it'not in all theses cases, the protocol is affected to rsh
441 resource.Protocol = rsh;
447 resource.Protocol = rsh;
449 if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
451 xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
455 resource.Mode = interactive;
458 resource.Mode = batch;
461 // If it'not in all theses cases, the mode is affected to interactive
462 resource.Mode = interactive;
468 resource.Mode = interactive;
470 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch))
472 xmlChar* batch = xmlGetProp(machine_descr, (const xmlChar*)test_batch);
473 std::string aBatch = (const char*)batch;
476 resource.Batch = pbs;
477 else if (aBatch == "lsf")
478 resource.Batch = lsf;
479 else if (aBatch == "sge")
480 resource.Batch = sge;
482 resource.Batch = none;
485 if (xmlHasProp(machine_descr, (const xmlChar*)test_mpi))
487 xmlChar* mpi = xmlGetProp(machine_descr, (const xmlChar*)test_mpi);
488 std::string anMpi = (const char*)mpi;
492 else if (anMpi == "mpich1")
493 resource.mpi = mpich1;
494 else if (anMpi == "mpich2")
495 resource.mpi = mpich2;
496 else if (anMpi == "openmpi")
497 resource.mpi = openmpi;
498 else if (anMpi == "slurm")
499 resource.mpi = slurm;
500 else if (anMpi == "prun")
503 resource.mpi = nompi;
506 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_name))
508 xmlChar* user_name= xmlGetProp(machine_descr, (const xmlChar*)test_user_name);
509 resource.UserName = (const char*)user_name;
513 if (xmlHasProp(machine_descr, (const xmlChar*)test_appli_path))
515 xmlChar* appli_path = xmlGetProp(machine_descr, (const xmlChar*)test_appli_path);
516 resource.AppliPath = (const char*)appli_path;
520 if (xmlHasProp(machine_descr, (const xmlChar*)test_os))
522 xmlChar* os = xmlGetProp(machine_descr, (const xmlChar*)test_os);
523 resource.OS = (const char*)os;
527 if (xmlHasProp(machine_descr, (const xmlChar*)test_mem_in_mb))
529 xmlChar* mem_in_mb = xmlGetProp(machine_descr, (const xmlChar*)test_mem_in_mb);
530 resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
534 if (xmlHasProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz))
536 xmlChar* cpu_freq_mhz = xmlGetProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz);
537 resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
538 xmlFree(cpu_freq_mhz);
541 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_nodes))
543 xmlChar* nb_of_nodes = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_nodes);
544 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
545 xmlFree(nb_of_nodes);
548 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node))
550 xmlChar* nb_of_proc_per_node = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node);
551 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
552 xmlFree(nb_of_proc_per_node);
555 // Process children nodes
556 xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
557 while(aCurSubNode != NULL)
559 // Process components
560 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
562 //If a component is given, it is in a module with the same name
563 //except if the module name is given
564 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
566 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
567 std::string aComponentName = (const char*)component_name;
568 _resource.ComponentsList.push_back(aComponentName);
569 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
571 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
572 std::string aModuleName = (const char*)module_name;
573 _resource.ModulesList.push_back(aModuleName);
574 xmlFree(module_name);
577 _resource.ModulesList.push_back(aComponentName);
578 xmlFree(component_name);
582 else if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
584 // If a module is given, we create an entry in componentsList and modulesList
585 // with the same name (module == component)
586 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
588 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
589 std::string aComponentName = (const char*)component_name;
590 _resource.ComponentsList.push_back(aComponentName);
591 _resource.ModulesList.push_back(aComponentName);
592 xmlFree(component_name);
595 aCurSubNode = aCurSubNode->next;
600 //=============================================================================
602 * Fill the document tree in xml file, used to write in an xml file.
603 * \param theDoc document to fill.
605 //=============================================================================
607 void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
610 xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
613 root_node = xmlNewNode(NULL, BAD_CAST "resources");
614 xmlDocSetRootElement(theDoc, root_node);
616 for (map<string, ParserResourcesType>::iterator iter =
617 _resources_list.begin();
618 iter != _resources_list.end();
621 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
622 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
623 xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
624 xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
625 xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
627 switch ((*iter).second.Protocol)
630 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
633 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
636 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
639 switch ((*iter).second.Mode)
642 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
645 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
648 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
651 switch ((*iter).second.Batch)
654 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
657 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
660 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
663 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
666 switch ((*iter).second.mpi)
669 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
672 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
675 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
678 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
681 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
684 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
687 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
690 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
692 for (vector<string>::const_iterator iter2 =
693 (*iter).second.ComponentsList.begin();
694 iter2 != (*iter).second.ComponentsList.end();
697 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
698 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
701 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
702 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
703 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
704 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
705 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));
707 for (map<string, ParserResourcesType>::iterator iter =
708 _resources_batch_list.begin();
709 iter != _resources_batch_list.end();
712 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
713 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
714 xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
716 switch ((*iter).second.Protocol)
719 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
722 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
725 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
728 switch ((*iter).second.Mode)
731 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
734 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
737 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
740 switch ((*iter).second.Batch)
743 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
746 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
749 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
752 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
755 switch ((*iter).second.mpi)
758 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
761 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
764 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
767 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
770 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
773 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
776 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
779 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
781 for (vector<string>::const_iterator iter2 =
782 (*iter).second.ComponentsList.begin();
783 iter2 != (*iter).second.ComponentsList.end();
786 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
787 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
790 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
791 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
792 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
793 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
794 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));