]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Do not over write CatalogResources for a job on localhost with SalomeLauncher. omu/fix_cfd_93
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Thu, 26 Sep 2019 11:24:57 +0000 (13:24 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Thu, 26 Sep 2019 11:24:57 +0000 (13:24 +0200)
When launching a job on localhost, SalomeLauncher used to create a new CatalogResources
file which contained only "localhost".
This behavior was changed in order to be able to use every resource of the original catalog
in a job launched on localhost.

This is needed by salome cfd.

src/Launcher/Launcher_Job_SALOME.cxx

index 492875a7465056be6f3f224c604d2758a6f75555..9321ba9188fba8cf59b992c3f4f0865822de9cd8 100644 (file)
@@ -97,33 +97,36 @@ Launcher::Job_SALOME::buildSalomeScript(Batch::Parametre params)
   launch_script_stream << "export SALOME_TMP_DIR=" << work_directory << "/logs" << std::endl;
 
   // -- Generates Catalog Resources
-  std::string resource_protocol = _resource_definition.getClusterInternalProtocolStr();
-  launch_script_stream << "if [ \"x$LIBBATCH_NODEFILE\" != \"x\" ]; then " << std::endl;
-  launch_script_stream << "CATALOG_FILE=" << "CatalogResources_" << _launch_date << ".xml" << std::endl;
-  launch_script_stream << "export USER_CATALOG_RESOURCES_FILE=" << "$CATALOG_FILE" << std::endl;
-  launch_script_stream << "{" << std::endl;
-  launch_script_stream << "echo '<!DOCTYPE ResourcesCatalog>'" << std::endl;
-  launch_script_stream << "echo '<resources>'" << std::endl;
-  launch_script_stream << "sort \"$LIBBATCH_NODEFILE\" | uniq -c | while read nbproc host"  << std::endl;
-  launch_script_stream << "do"                                                  << std::endl;
-  // Full name doesn't work. eg: sagittaire-7 instead of sagittaire-7.lyon.grid5000.fr
-  launch_script_stream << "host_basename=$(echo \"$host\" | cut -f1 -d.)"                                                  << std::endl;
-  launch_script_stream << "echo '<machine name='\\\"\"$host_basename\"\\\"" << std::endl;
-  launch_script_stream << "echo '         hostname='\\\"\"$host_basename\"\\\"" << std::endl;
-  launch_script_stream << "echo '         type=\"single_machine\"'" << std::endl;
-  launch_script_stream << "echo '         protocol=\"" << resource_protocol               << "\"'" << std::endl;
-  launch_script_stream << "echo '         userName=\"" << _resource_definition.UserName   << "\"'" << std::endl;
-  launch_script_stream << "echo '         appliPath=\"" << _resource_definition.AppliPath << "\"'" << std::endl;
-  launch_script_stream << "echo '         mpi=\"" << _resource_definition.getMpiImplTypeStr() << "\"'" << std::endl;
-  launch_script_stream << "echo '         nbOfNodes='\\\"\"$nbproc\"\\\"" << std::endl;
-  launch_script_stream << "echo '         nbOfProcPerNode=\"1\"'" << std::endl;
-  launch_script_stream << "echo '         canRunContainers=\"true\"'" << std::endl;
-  launch_script_stream << "echo '/>'" << std::endl;
-  launch_script_stream << "done"                                 << std::endl;
-  launch_script_stream << "echo '</resources>'" << std::endl;
-  launch_script_stream << "} > $CATALOG_FILE" << std::endl;
-  launch_script_stream << "fi" << std::endl;
-
+  // do not build a new catalog if the job is launched on localhost
+  if(_resource_required_params.name != "localhost")
+  {
+    std::string resource_protocol = _resource_definition.getClusterInternalProtocolStr();
+    launch_script_stream << "if [ \"x$LIBBATCH_NODEFILE\" != \"x\" ]; then " << std::endl;
+    launch_script_stream << "CATALOG_FILE=" << "CatalogResources_" << _launch_date << ".xml" << std::endl;
+    launch_script_stream << "export USER_CATALOG_RESOURCES_FILE=" << "$CATALOG_FILE" << std::endl;
+    launch_script_stream << "{" << std::endl;
+    launch_script_stream << "echo '<!DOCTYPE ResourcesCatalog>'" << std::endl;
+    launch_script_stream << "echo '<resources>'" << std::endl;
+    launch_script_stream << "sort \"$LIBBATCH_NODEFILE\" | uniq -c | while read nbproc host"  << std::endl;
+    launch_script_stream << "do"                                                  << std::endl;
+    // Full name doesn't work. eg: sagittaire-7 instead of sagittaire-7.lyon.grid5000.fr
+    launch_script_stream << "host_basename=$(echo \"$host\" | cut -f1 -d.)"   << std::endl;
+    launch_script_stream << "echo '<machine name='\\\"\"$host_basename\"\\\"" << std::endl;
+    launch_script_stream << "echo '         hostname='\\\"\"$host_basename\"\\\"" << std::endl;
+    launch_script_stream << "echo '         type=\"single_machine\"'" << std::endl;
+    launch_script_stream << "echo '         protocol=\"" << resource_protocol               << "\"'" << std::endl;
+    launch_script_stream << "echo '         userName=\"" << _resource_definition.UserName   << "\"'" << std::endl;
+    launch_script_stream << "echo '         appliPath=\"" << _resource_definition.AppliPath << "\"'" << std::endl;
+    launch_script_stream << "echo '         mpi=\"" << _resource_definition.getMpiImplTypeStr() << "\"'" << std::endl;
+    launch_script_stream << "echo '         nbOfNodes='\\\"\"$nbproc\"\\\"" << std::endl;
+    launch_script_stream << "echo '         nbOfProcPerNode=\"1\"'" << std::endl;
+    launch_script_stream << "echo '         canRunContainers=\"true\"'" << std::endl;
+    launch_script_stream << "echo '/>'" << std::endl;
+    launch_script_stream << "done"                                 << std::endl;
+    launch_script_stream << "echo '</resources>'" << std::endl;
+    launch_script_stream << "} > $CATALOG_FILE" << std::endl;
+    launch_script_stream << "fi" << std::endl;
+  }
   // Create file for ns-port-log
   launch_script_stream << "NS_PORT_FILE_PATH=$(mktemp " << _resource_definition.AppliPath << "/USERS/nsport_XXXXXX) &&\n";