Salome HOME
Merge from mergeto_V5_1_main_19Jan10
[modules/kernel.git] / src / ResourcesManager / SALOME_ResourcesCatalog_Handler.cxx
index d4f5d269b5284e2aef6e7193236d5c2d5276f543..2cf3e8b7280fa1cdb4ed78db15b0cbf591c3467c 100755 (executable)
@@ -40,17 +40,15 @@ using namespace std;
 //=============================================================================
 
 SALOME_ResourcesCatalog_Handler::
-SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list,
-                               MapOfParserResourcesType& resources_batch_list):
-    _resources_list(resources_list),
-    _resources_batch_list(resources_batch_list)
+SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list): _resources_list(resources_list)
 {
   //XML tags initialisation
   test_machine = "machine";
   test_cluster = "cluster";
+  test_name = "name";
   test_hostname = "hostname";
-  test_alias = "alias";
   test_protocol = "protocol";
+  test_cluster_internal_protocol = "iprotocol";
   test_mode = "mode";
   test_batch = "batch";
   test_mpi = "mpi";
@@ -115,56 +113,39 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
   while(aCurNode != NULL)
   {
     // Cas d'une machine ou d'une machine batch
-    if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine) )
+    if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine))
     {
       _resource.Clear();
       bool Ok = ProcessMachine(aCurNode, _resource);
       if (Ok)
       {
-       // There is two lists
-       // _resources_list for interactive resources
-       // _resources_batch_list for batch resources
-       // This choice is done with Mode parameter
-       if (_resource.Mode == interactive)
+       // Adding a resource
+       if(_resource.HostName == "localhost")
        {
-         // Adding a generic cluster
-         int aNbNodes = _resource.DataForSort._nbOfNodes;
-         if( aNbNodes > 1 ){
-           string clusterNode = _resource.DataForSort._hostName ;
-           for( int i=0; i < aNbNodes; i++ ){
-             char inode[64];
-             inode[0] = '\0' ;
-             sprintf(inode,"%s%d",clusterNode.c_str(),i+1);
-             std::string nodeName(inode);
-             _resource.DataForSort._hostName = nodeName ;
-             _resource.HostName = nodeName ;
-             _resources_list[nodeName] = _resource;
-           }
-         }
-         else
+         _resource.HostName = Kernel_Utils::GetHostname();
+         if (_resource.Name == "localhost")
          {
-           // Adding a machine
-        if(_resource.HostName == "localhost")
-          {
-            _resource.HostName = Kernel_Utils::GetHostname();
-            _resource.DataForSort._hostName = Kernel_Utils::GetHostname();
-            _resources_list[Kernel_Utils::GetHostname()] = _resource;
-          }
-        else
-          _resources_list[_resource.HostName] = _resource;
+           _resource.Name = Kernel_Utils::GetHostname();
+           _resource.DataForSort._Name = Kernel_Utils::GetHostname();
          }
        }
-       else
-         // Adding a batch machine/cluster
-         _resources_batch_list[_resource.HostName] = _resource;
+       map<string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
+       if (iter != _resources_list.end())
+         RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
+       _resources_list[_resource.Name] = _resource;
       }
     }
-    if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster) )
+    // Cas de la déclaration d'un cluster
+    if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster))
     {
-      // Cas de la déclaration d'un cluster
       _resource.Clear();
       if(ProcessCluster(aCurNode, _resource))
-       _resources_list[_resource.HostName] = _resource;
+      {
+       map<string, ParserResourcesType>::const_iterator iter = _resources_list.find(_resource.Name);
+       if (iter != _resources_list.end())
+         RES_INFOS("Warning resource " << _resource.Name << " already added, keep last resource found !");
+       _resources_list[_resource.Name] = _resource;
+      }
     }
     aCurNode = aCurNode->next;
   }
@@ -174,17 +155,21 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
        iter != _resources_list.end();
        iter++)
   {
-    std::cerr << (*iter).first << std::endl;
-    std::cerr << (*iter).second.HostName << std::endl;
-    std::cerr << (*iter).second.Alias << std::endl;
-    std::cerr << (*iter).second.UserName << std::endl;
-    std::cerr << (*iter).second.AppliPath << std::endl;
-    std::cerr << (*iter).second.OS << std::endl;
-    std::cerr << (*iter).second.Protocol << std::endl;
-    std::cerr << (*iter).second.Mode << std::endl;
+    std::cerr << "************************************************" << std::endl;
+    std::cerr << "Resource " << (*iter).first << " found:" << std::endl;
+    std::cerr << " Name: " << (*iter).second.Name << std::endl;
+    std::cerr << " Hostname: " << (*iter).second.HostName << std::endl;
+    std::cerr << " Username: " << (*iter).second.UserName << std::endl;
+    std::cerr << " Appli path: " <<(*iter).second.AppliPath << std::endl;
+    std::cerr << " OS: " << (*iter).second.OS << std::endl;
+    std::cerr << " Protocol: " << (*iter).second.PrintAccessProtocolType() << std::endl;
+    std::cerr << " Internal Protocol: " <<(*iter).second.PrintClusterInternalProtocol() << std::endl;
+    std::cerr << " Mode: " << (*iter).second.PrintAccessModeType() << std::endl;
+    std::cerr << " Batch Type: " << (*iter).second.PrintBatchType() << std::endl;
+    std::cerr << " MPI Impl: " << (*iter).second.PrintMpiImplType() << std::endl;
+    std::cerr << "************************************************" << std::endl;
   }
 #endif
-
 }
 
 bool
@@ -195,7 +180,6 @@ SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, Parser
   if (xmlHasProp(cluster_descr, (const xmlChar*)test_hostname))
   {
     xmlChar* hostname = xmlGetProp(cluster_descr, (const xmlChar*)test_hostname);
-    resource.DataForSort._hostName = (const char*)hostname;
     resource.HostName = (const char*)hostname;
     xmlFree(hostname);
   }
@@ -206,6 +190,20 @@ SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, Parser
     return false;
   }
 
+  if (xmlHasProp(cluster_descr, (const xmlChar*)test_name))
+  {
+    xmlChar* name = xmlGetProp(cluster_descr, (const xmlChar*)test_name);
+    resource.Name = (const char*)name;
+    resource.DataForSort._Name = (const char*)name;
+    xmlFree(name);
+  }
+  else
+  {
+    resource.Name = resource.HostName;
+    resource.DataForSort._Name = resource.HostName;
+    std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
+  }
+
   if (xmlHasProp(cluster_descr, (const xmlChar*)test_use))
   {
     xmlChar* use = xmlGetProp(cluster_descr, (const xmlChar*)test_use);
@@ -262,14 +260,14 @@ SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, Parser
        xmlNodePtr members = aCurSubNode->xmlChildrenNode;
        while (members != NULL)
        {
-        // Process members
-        if (!xmlStrcmp(members->name, (const xmlChar*)test_machine))
-        {
-          ParserResourcesClusterMembersType new_member;
-          if (ProcessMember(members, new_member))
-            resource.ClusterMembersList.push_back(new_member);
-        }
-        members = members->next;
+         // Process members
+         if (!xmlStrcmp(members->name, (const xmlChar*)test_machine))
+         {
+           ParserResourcesClusterMembersType new_member;
+           if (ProcessMember(members, new_member))
+             resource.ClusterMembersList.push_back(new_member);
+         }
+         members = members->next;
        }
     }
     aCurSubNode = aCurSubNode->next;
@@ -291,7 +289,6 @@ SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserRe
   if (xmlHasProp(member_descr, (const xmlChar*)test_hostname))
   {
     xmlChar* hostname = xmlGetProp(member_descr, (const xmlChar*)test_hostname);
-    resource.DataForSort._hostName = (const char*)hostname;
     resource.HostName = (const char*)hostname;
     xmlFree(hostname);
   }
@@ -308,15 +305,15 @@ SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserRe
     switch (protocol[0])
     {
       case 'r':
-       resource.Protocol = rsh;
-       break;
+        resource.Protocol = rsh;
+        break;
       case 's':
-       resource.Protocol = ssh;
-       break;
+        resource.Protocol = ssh;
+        break;
       default:
-       std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
-       std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
-       return false;
+        std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
+        std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
+        return false;
     }
     xmlFree(protocol);
   }
@@ -327,6 +324,31 @@ SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserRe
     return false;
   }
 
+  if (xmlHasProp(member_descr, (const xmlChar*)test_cluster_internal_protocol))
+  {
+    xmlChar* iprotocol= xmlGetProp(member_descr, (const xmlChar*)test_cluster_internal_protocol);
+    switch (iprotocol[0])
+    {
+      case 'r':
+        resource.ClusterInternalProtocol = rsh;
+        break;
+      case 's':
+        resource.ClusterInternalProtocol = ssh;
+        break;
+      default:
+        std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
+        std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
+        return false;
+    }
+    xmlFree(iprotocol);
+  }
+  else
+  {
+    std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
+    std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
+    return false;
+  }
+
   if (xmlHasProp(member_descr, (const xmlChar*)test_user_name))
   {
     xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name);
@@ -387,7 +409,6 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser
   if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
   {
     xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
-    resource.DataForSort._hostName = (const char*)hostname;
     resource.HostName = (const char*)hostname;
     xmlFree(hostname);
   }
@@ -398,14 +419,19 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser
     return false;
   }
 
-  if (xmlHasProp(machine_descr, (const xmlChar*)test_alias))
+  if (xmlHasProp(machine_descr, (const xmlChar*)test_name))
   {
-    xmlChar* alias = xmlGetProp(machine_descr, (const xmlChar*)test_alias);
-    resource.Alias = (const char*)alias;
-    xmlFree(alias);
+    xmlChar* name = xmlGetProp(machine_descr, (const xmlChar*)test_name);
+    resource.Name = (const char*)name;
+    resource.DataForSort._Name = (const char*)name;
+    xmlFree(name);
   }
   else
-    resource.Alias = "";
+  {
+    resource.Name = resource.HostName;
+    resource.DataForSort._Name = resource.HostName;
+    std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
+  }
 
   if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
   {
@@ -431,36 +457,57 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser
     switch ( protocol[0])
     {
       case 'r':
-       resource.Protocol = rsh;
-       break;
+        resource.Protocol = rsh;
+        break;
       case 's':
-       resource.Protocol = ssh;
-       break;
+        resource.Protocol = ssh;
+        break;
       default:
-       // If it'not in all theses cases, the protocol is affected to rsh
-       resource.Protocol = rsh;
-       break;
+        // If it'not in all theses cases, the protocol is affected to rsh
+        resource.Protocol = rsh;
+        break;
     }
     xmlFree(protocol);
   }
   else
     resource.Protocol = rsh;
 
+  if (xmlHasProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol))
+  {
+    xmlChar* iprotocol= xmlGetProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol);
+    switch ( iprotocol[0])
+    {
+      case 'r':
+        resource.ClusterInternalProtocol = rsh;
+        break;
+      case 's':
+        resource.ClusterInternalProtocol = ssh;
+        break;
+      default:
+        // If it'not in all theses cases, the protocol is affected to rsh
+        resource.ClusterInternalProtocol = rsh;
+        break;
+    }
+    xmlFree(iprotocol);
+  }
+  else
+    resource.ClusterInternalProtocol = resource.Protocol;
+
   if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
   {
     xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
     switch ( mode[0] )
     {
       case 'i':
-       resource.Mode = interactive;
-       break;
+        resource.Mode = interactive;
+        break;
       case 'b':
-       resource.Mode = batch;
-       break;
+        resource.Mode = batch;
+        break;
       default:
-       // If it'not in all theses cases, the mode is affected to interactive
-       resource.Mode = interactive;
-       break;
+        // If it'not in all theses cases, the mode is affected to interactive
+        resource.Mode = interactive;
+        break;
     }
     xmlFree(mode);
   }
@@ -478,6 +525,8 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser
       resource.Batch = lsf;
     else if  (aBatch == "sge")
       resource.Batch = sge;
+    else if  (aBatch == "ssh_batch")
+      resource.Batch = ssh_batch;
     else
       resource.Batch = none;
   }
@@ -563,19 +612,19 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser
       //except if the module name is given
       if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name)) 
       {
-       xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
-       std::string aComponentName = (const char*)component_name;
-       _resource.ComponentsList.push_back(aComponentName);
-       if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name)) 
-       {
-         xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
-         std::string aModuleName = (const char*)module_name;
-         _resource.ModulesList.push_back(aModuleName);
-         xmlFree(module_name);
-       }
-       else
-         _resource.ModulesList.push_back(aComponentName);
-       xmlFree(component_name);
+        xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
+        std::string aComponentName = (const char*)component_name;
+        _resource.ComponentsList.push_back(aComponentName);
+        if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name)) 
+        {
+          xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
+          std::string aModuleName = (const char*)module_name;
+          _resource.ModulesList.push_back(aModuleName);
+          xmlFree(module_name);
+        }
+        else
+          _resource.ModulesList.push_back(aComponentName);
+        xmlFree(component_name);
       }
     }
     // Process modules
@@ -613,184 +662,106 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
   root_node = xmlNewNode(NULL, BAD_CAST "resources");
   xmlDocSetRootElement(theDoc, root_node);
     
-  for (map<string, ParserResourcesType>::iterator iter =
-         _resources_list.begin();
-       iter != _resources_list.end();
-       iter++)
-    {
-      node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
-      xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
-      xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
-      xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
-      xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
-  
-      switch ((*iter).second.Protocol)
-        {
-        case rsh:
-         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
-          break;
-        case ssh:
-         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
-         break;
-        default:
-         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
-       }
-
-      switch ((*iter).second.Mode)
-        {
-       case interactive:
-         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
-          break;
-        case batch:
-         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
-          break;
-        default:
-         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
-        }
-
-      switch ((*iter).second.Batch)
-        {
-       case pbs:
-         xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
-          break;
-       case lsf:
-         xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
-          break;
-       case sge:
-         xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
-          break;
-        default:
-         xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
-        }
-
-      switch ((*iter).second.mpi)
-        {
-       case lam:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
-          break;
-       case mpich1:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
-          break;
-       case mpich2:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
-          break;
-       case openmpi:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
-          break;
-       case slurm:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
-          break;
-       case prun:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
-          break;
-        default:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
-        }
-
-      xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
-
-     for (vector<string>::const_iterator iter2 =
-             (*iter).second.ComponentsList.begin();
-           iter2 != (*iter).second.ComponentsList.end();
-           iter2++)
-        {
-         node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
-         xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
-        }
+  std::map<std::string, ParserResourcesType>::iterator iter = _resources_list.begin();
+  for (; iter != _resources_list.end(); iter++)
+  {
+    node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
+    xmlNewProp(node, BAD_CAST test_name, BAD_CAST (*iter).second.Name.c_str());
+    xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
+    xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
+    xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
 
-      xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
-      xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
-      xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
-      xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
-      xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));
-    }
-  for (map<string, ParserResourcesType>::iterator iter =
-         _resources_batch_list.begin();
-       iter != _resources_batch_list.end();
-       iter++)
+    switch ((*iter).second.Protocol)
     {
-      node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
-      xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
-      xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
-      
-      switch ((*iter).second.Protocol)
-        {
-        case rsh:
-         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
-          break;
-        case ssh:
-         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
-         break;
-        default:
-         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
-       }
+      case rsh:
+        xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
+        break;
+      case ssh:
+        xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
+        break;
+      default:
+        xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
+    }
 
-      switch ((*iter).second.Mode)
-        {
-       case interactive:
-         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
-          break;
-        case batch:
-         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
-          break;
-        default:
-         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
-        }
+    switch ((*iter).second.ClusterInternalProtocol)
+    {
+      case rsh:
+        xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
+        break;
+      case ssh:
+        xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "ssh");
+        break;
+      default:
+        xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
+    }
 
-      switch ((*iter).second.Batch)
-        {
-       case pbs:
-         xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
-          break;
-       case lsf:
-         xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
-          break;
-       case sge:
-         xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
-          break;
-        default:
-         xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
-        }
+    switch ((*iter).second.Mode)
+    {
+      case interactive:
+        xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
+        break;
+      case batch:
+        xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
+        break;
+      default:
+        xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
+    }
 
-      switch ((*iter).second.mpi)
-        {
-       case lam:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
-          break;
-       case mpich1:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
-          break;
-       case mpich2:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
-          break;
-       case openmpi:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
-          break;
-       case slurm:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
-          break;
-       case prun:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
-          break;
-        default:
-         xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
-        }
+    switch ((*iter).second.Batch)
+    {
+      case pbs:
+        xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
+        break;
+      case lsf:
+        xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
+        break;
+      case sge:
+        xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
+        break;
+      case ssh_batch:
+        xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ssh_batch");
+        break;
+      default:
+        xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
+    }
 
-      xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
+    switch ((*iter).second.mpi)
+    {
+      case lam:
+        xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
+        break;
+      case mpich1:
+        xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
+        break;
+      case mpich2:
+        xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
+        break;
+      case openmpi:
+        xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
+        break;
+      case slurm:
+        xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
+        break;
+      case prun:
+        xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
+        break;
+      default:
+        xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
+    }
 
-     for (vector<string>::const_iterator iter2 =
-             (*iter).second.ComponentsList.begin();
-           iter2 != (*iter).second.ComponentsList.end();
-           iter2++)
-        {
-         node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
-         xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
-        }
+    xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
 
-      xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
-      xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
-      xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
-      xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
-      xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));
+    std::vector<std::string>::const_iterator iter2 = (*iter).second.ComponentsList.begin();
+    for(;iter2 != (*iter).second.ComponentsList.end(); iter2++)
+    {
+      node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
+      xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
     }
+
+    xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
+    xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
+    xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
+    xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
+    xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));
+  }
 }