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): _resources_list(resources_list)
45 //XML tags initialisation
46 test_machine = "machine";
47 test_cluster = "cluster";
49 test_hostname = "hostname";
50 test_protocol = "protocol";
51 test_cluster_internal_protocol = "iprotocol";
55 test_user_name = "userName";
56 test_appli_path = "appliPath";
57 test_modules = "modules";
58 test_module_name = "moduleName";
59 test_components = "component";
60 test_component_name = "name";
62 test_mem_in_mb = "memInMB";
63 test_cpu_freq_mhz = "CPUFreqMHz";
64 test_nb_of_nodes = "nbOfNodes";
65 test_nb_of_proc = "nbOfProc";
66 test_nb_of_proc_per_node = "nbOfProcPerNode";
67 test_batch_queue = "batchQueue";
68 test_user_commands = "userCommands";
70 test_members = "members";
73 //=============================================================================
77 //=============================================================================
79 SALOME_ResourcesCatalog_Handler::~SALOME_ResourcesCatalog_Handler()
81 // cout << "SALOME_ResourcesCatalog_Handler destruction") << endl;
84 //=============================================================================
86 * Retrieves DS after the file parse.
88 //=============================================================================
90 const MapOfParserResourcesType&
91 SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const
93 return _resources_list;
96 //=============================================================================
98 * Processes XML document and fills the list of resources
100 //=============================================================================
102 void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
104 // Empty private elements
105 _resources_list.clear();
107 // Get the document root node
108 xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
110 aCurNode = aCurNode->xmlChildrenNode;
112 // Processing the document nodes
113 while(aCurNode != NULL)
115 // Cas d'une machine ou d'une machine batch
116 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine))
119 bool Ok = ProcessMachine(aCurNode, _resource);
123 if(_resource.HostName == "localhost")
125 _resource.HostName = Kernel_Utils::GetHostname();
126 if (_resource.Name == "localhost")
128 _resource.Name = Kernel_Utils::GetHostname();
129 _resource.DataForSort._Name = Kernel_Utils::GetHostname();
132 map<string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
133 if (iter != _resources_list.end())
134 RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
135 _resources_list[_resource.Name] = _resource;
138 // Cas de la déclaration d'un cluster
139 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster))
142 if(ProcessCluster(aCurNode, _resource))
144 map<string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
145 if (iter != _resources_list.end())
146 RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
147 _resources_list[_resource.Name] = _resource;
150 aCurNode = aCurNode->next;
154 for (map<string, ParserResourcesType>::const_iterator iter = _resources_list.begin();
155 iter != _resources_list.end();
158 std::cerr << "************************************************" << std::endl;
159 std::cerr << "Resource " << (*iter).first << " found:" << std::endl;
160 std::cerr << " Name: " << (*iter).second.Name << std::endl;
161 std::cerr << " Hostname: " << (*iter).second.HostName << std::endl;
162 std::cerr << " Username: " << (*iter).second.UserName << std::endl;
163 std::cerr << " Appli path: " <<(*iter).second.AppliPath << std::endl;
164 std::cerr << " OS: " << (*iter).second.OS << std::endl;
165 std::cerr << " Protocol: " << (*iter).second.PrintAccessProtocolType() << std::endl;
166 std::cerr << " Internal Protocol: " <<(*iter).second.PrintClusterInternalProtocol() << std::endl;
167 std::cerr << " Mode: " << (*iter).second.PrintAccessModeType() << std::endl;
168 std::cerr << " Batch Type: " << (*iter).second.PrintBatchType() << std::endl;
169 std::cerr << " MPI Impl: " << (*iter).second.PrintMpiImplType() << std::endl;
170 std::cerr << "************************************************" << std::endl;
176 SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, ParserResourcesType & resource)
178 // Ajout d'un cluster
179 // hostname, use et nbOfProc sont obligatoires
180 if (xmlHasProp(cluster_descr, (const xmlChar*)test_hostname))
182 xmlChar* hostname = xmlGetProp(cluster_descr, (const xmlChar*)test_hostname);
183 resource.HostName = (const char*)hostname;
188 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a hostname" << std::endl;
189 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
193 if (xmlHasProp(cluster_descr, (const xmlChar*)test_name))
195 xmlChar* name = xmlGetProp(cluster_descr, (const xmlChar*)test_name);
196 resource.Name = (const char*)name;
197 resource.DataForSort._Name = (const char*)name;
202 resource.Name = resource.HostName;
203 resource.DataForSort._Name = resource.HostName;
204 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
207 if (xmlHasProp(cluster_descr, (const xmlChar*)test_use))
209 xmlChar* use = xmlGetProp(cluster_descr, (const xmlChar*)test_use);
210 resource.use = (const char*)use;
215 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a use" << std::endl;
216 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
220 if (xmlHasProp(cluster_descr, (const xmlChar*)test_nb_of_proc))
222 xmlChar* nb_of_proc = xmlGetProp(cluster_descr, (const xmlChar*)test_nb_of_proc);
223 resource.nbOfProc = atoi((const char*)nb_of_proc);
228 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a nbOfProc" << std::endl;
229 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
233 if (xmlHasProp(cluster_descr, (const xmlChar*)test_mpi))
235 xmlChar* mpi = xmlGetProp(cluster_descr, (const xmlChar*)test_mpi);
236 std::string anMpi = (const char*)mpi;
240 else if (anMpi == "mpich1")
241 resource.mpi = mpich1;
242 else if (anMpi == "mpich2")
243 resource.mpi = mpich2;
244 else if (anMpi == "openmpi")
245 resource.mpi = openmpi;
246 else if (anMpi == "slurm")
247 resource.mpi = slurm;
248 else if (anMpi == "prun")
251 resource.mpi = nompi;
254 // Parsing des membres du cluster
255 xmlNodePtr aCurSubNode = cluster_descr->xmlChildrenNode;
256 while(aCurSubNode != NULL)
258 if (!xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_members))
260 xmlNodePtr members = aCurSubNode->xmlChildrenNode;
261 while (members != NULL)
264 if (!xmlStrcmp(members->name, (const xmlChar*)test_machine))
266 ParserResourcesClusterMembersType new_member;
267 if (ProcessMember(members, new_member))
268 resource.ClusterMembersList.push_back(new_member);
270 members = members->next;
273 aCurSubNode = aCurSubNode->next;
276 // Test: Il faut au moins un membre pour que le cluster soit correct !
277 if (resource.ClusterMembersList.empty())
279 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a member" << std::endl;
280 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
287 SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserResourcesClusterMembersType & resource)
289 if (xmlHasProp(member_descr, (const xmlChar*)test_hostname))
291 xmlChar* hostname = xmlGetProp(member_descr, (const xmlChar*)test_hostname);
292 resource.HostName = (const char*)hostname;
297 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a hostname" << std::endl;
298 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
302 if (xmlHasProp(member_descr, (const xmlChar*)test_protocol))
304 xmlChar* protocol= xmlGetProp(member_descr, (const xmlChar*)test_protocol);
308 resource.Protocol = rsh;
311 resource.Protocol = ssh;
314 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
315 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
322 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
323 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
327 if (xmlHasProp(member_descr, (const xmlChar*)test_cluster_internal_protocol))
329 xmlChar* iprotocol= xmlGetProp(member_descr, (const xmlChar*)test_cluster_internal_protocol);
330 switch (iprotocol[0])
333 resource.ClusterInternalProtocol = rsh;
336 resource.ClusterInternalProtocol = ssh;
339 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
340 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
347 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
348 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
352 if (xmlHasProp(member_descr, (const xmlChar*)test_user_name))
354 xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name);
355 resource.UserName = (const char*)user_name;
360 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a user name" << std::endl;
361 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
365 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_nodes))
367 xmlChar* nb_of_nodes = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_nodes);
368 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
369 xmlFree(nb_of_nodes);
373 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfNodes" << std::endl;
374 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
378 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node))
380 xmlChar* nb_of_proc_per_node = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node);
381 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
382 xmlFree(nb_of_proc_per_node);
386 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfProcPerNode" << std::endl;
387 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
391 if (xmlHasProp(member_descr, (const xmlChar*)test_appli_path))
393 xmlChar* appli_path = xmlGetProp(member_descr, (const xmlChar*)test_appli_path);
394 resource.AppliPath = (const char*)appli_path;
399 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a AppliPath" << std::endl;
400 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
407 SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, ParserResourcesType & resource)
409 if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
411 xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
412 resource.HostName = (const char*)hostname;
417 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning found a machine without a hostname" << std::endl;
418 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning this machine will not be added" << std::endl;
422 if (xmlHasProp(machine_descr, (const xmlChar*)test_name))
424 xmlChar* name = xmlGetProp(machine_descr, (const xmlChar*)test_name);
425 resource.Name = (const char*)name;
426 resource.DataForSort._Name = (const char*)name;
431 resource.Name = resource.HostName;
432 resource.DataForSort._Name = resource.HostName;
433 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
436 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
438 xmlChar* batch_queue = xmlGetProp(machine_descr, (const xmlChar*)test_batch_queue);
439 resource.batchQueue = (const char*)batch_queue;
440 xmlFree(batch_queue);
443 resource.batchQueue = "";
445 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_commands))
447 xmlChar* user_commands= xmlGetProp(machine_descr, (const xmlChar*)test_user_commands);
448 resource.userCommands = (const char*)user_commands;
449 xmlFree(user_commands);
452 resource.userCommands = "";
454 if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
456 xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
457 switch ( protocol[0])
460 resource.Protocol = rsh;
463 resource.Protocol = ssh;
466 // If it'not in all theses cases, the protocol is affected to rsh
467 resource.Protocol = rsh;
473 resource.Protocol = rsh;
475 if (xmlHasProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol))
477 xmlChar* iprotocol= xmlGetProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol);
478 switch ( iprotocol[0])
481 resource.ClusterInternalProtocol = rsh;
484 resource.ClusterInternalProtocol = ssh;
487 // If it'not in all theses cases, the protocol is affected to rsh
488 resource.ClusterInternalProtocol = rsh;
494 resource.ClusterInternalProtocol = resource.Protocol;
496 if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
498 xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
502 resource.Mode = interactive;
505 resource.Mode = batch;
508 // If it'not in all theses cases, the mode is affected to interactive
509 resource.Mode = interactive;
515 resource.Mode = interactive;
517 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch))
519 xmlChar* batch = xmlGetProp(machine_descr, (const xmlChar*)test_batch);
520 std::string aBatch = (const char*)batch;
523 resource.Batch = pbs;
524 else if (aBatch == "lsf")
525 resource.Batch = lsf;
526 else if (aBatch == "sge")
527 resource.Batch = sge;
528 else if (aBatch == "ssh_batch")
529 resource.Batch = ssh_batch;
531 resource.Batch = none;
534 if (xmlHasProp(machine_descr, (const xmlChar*)test_mpi))
536 xmlChar* mpi = xmlGetProp(machine_descr, (const xmlChar*)test_mpi);
537 std::string anMpi = (const char*)mpi;
541 else if (anMpi == "mpich1")
542 resource.mpi = mpich1;
543 else if (anMpi == "mpich2")
544 resource.mpi = mpich2;
545 else if (anMpi == "openmpi")
546 resource.mpi = openmpi;
547 else if (anMpi == "slurm")
548 resource.mpi = slurm;
549 else if (anMpi == "prun")
552 resource.mpi = nompi;
555 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_name))
557 xmlChar* user_name= xmlGetProp(machine_descr, (const xmlChar*)test_user_name);
558 resource.UserName = (const char*)user_name;
562 if (xmlHasProp(machine_descr, (const xmlChar*)test_appli_path))
564 xmlChar* appli_path = xmlGetProp(machine_descr, (const xmlChar*)test_appli_path);
565 resource.AppliPath = (const char*)appli_path;
569 if (xmlHasProp(machine_descr, (const xmlChar*)test_os))
571 xmlChar* os = xmlGetProp(machine_descr, (const xmlChar*)test_os);
572 resource.OS = (const char*)os;
576 if (xmlHasProp(machine_descr, (const xmlChar*)test_mem_in_mb))
578 xmlChar* mem_in_mb = xmlGetProp(machine_descr, (const xmlChar*)test_mem_in_mb);
579 resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
583 if (xmlHasProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz))
585 xmlChar* cpu_freq_mhz = xmlGetProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz);
586 resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
587 xmlFree(cpu_freq_mhz);
590 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_nodes))
592 xmlChar* nb_of_nodes = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_nodes);
593 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
594 xmlFree(nb_of_nodes);
597 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node))
599 xmlChar* nb_of_proc_per_node = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node);
600 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
601 xmlFree(nb_of_proc_per_node);
604 // Process children nodes
605 xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
606 while(aCurSubNode != NULL)
608 // Process components
609 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
611 //If a component is given, it is in a module with the same name
612 //except if the module name is given
613 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
615 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
616 std::string aComponentName = (const char*)component_name;
617 _resource.ComponentsList.push_back(aComponentName);
618 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
620 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
621 std::string aModuleName = (const char*)module_name;
622 _resource.ModulesList.push_back(aModuleName);
623 xmlFree(module_name);
626 _resource.ModulesList.push_back(aComponentName);
627 xmlFree(component_name);
631 else if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
633 // If a module is given, we create an entry in componentsList and modulesList
634 // with the same name (module == component)
635 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
637 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
638 std::string aComponentName = (const char*)component_name;
639 _resource.ComponentsList.push_back(aComponentName);
640 _resource.ModulesList.push_back(aComponentName);
641 xmlFree(component_name);
644 aCurSubNode = aCurSubNode->next;
649 //=============================================================================
651 * Fill the document tree in xml file, used to write in an xml file.
652 * \param theDoc document to fill.
654 //=============================================================================
656 void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
659 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 xmlNewProp(node, BAD_CAST test_name, BAD_CAST (*iter).second.Name.c_str());
670 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
671 xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
672 xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
674 switch ((*iter).second.Protocol)
677 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
680 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
683 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
686 switch ((*iter).second.ClusterInternalProtocol)
689 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
692 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "ssh");
695 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
698 switch ((*iter).second.Mode)
701 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
704 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
707 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
710 switch ((*iter).second.Batch)
713 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
716 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
719 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
722 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ssh_batch");
725 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
728 switch ((*iter).second.mpi)
731 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
734 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
737 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
740 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
743 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
746 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
749 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
752 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
754 std::vector<std::string>::const_iterator iter2 = (*iter).second.ComponentsList.begin();
755 for(;iter2 != (*iter).second.ComponentsList.end(); iter2++)
757 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
758 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
761 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
762 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
763 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
764 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
765 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));