Salome HOME
unification des launcher python et exe, pour passage au mode exe du lanceur salome
[tools/sat.git] / commands / application.py
index 9067b0a530ee2928d075e12f41030bfe3105aae7..1ce718952e9ce8cbcb70c6d33a56570a532ee3a6 100644 (file)
@@ -108,8 +108,8 @@ def create_config_file(config, modules, env_files, logger):
             if src.product.product_is_cpp(mm):
                 # cpp module
                 for aa in src.product.get_product_components(mm):
-                    install_dir = os.path.join(config.APPLICATION.workdir,
-                                               "INSTALL")
+                    install_dir=os.path.join(config.APPLICATION.workdir,
+                                             config.INTERNAL.config.install_dir)
                     mp = os.path.join(install_dir, aa)
                     flagline = add_module_to_appli(f,
                                                    aa,
@@ -342,36 +342,41 @@ def generate_catalog(machines, config, logger):
     catalog = file(catfile, "w")
     catalog.write("<!DOCTYPE ResourcesCatalog>\n<resources>\n")
     for k in machines:
-        logger.write("    ssh %s " % (k + " ").ljust(20, '.'), 4)
-        logger.flush()
-
-        ssh_cmd = 'ssh -o "StrictHostKeyChecking no" %s %s' % (k, cmd)
-        p = subprocess.Popen(ssh_cmd, shell=True,
-                stdin=subprocess.PIPE,
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE)
-        p.wait()
-
-        if p.returncode != 0:
-            logger.write(src.printcolors.printc(src.KO_STATUS) + "\n", 4)
-            logger.write("    " + src.printcolors.printcWarning(p.stderr.read()),
-                         2)
-        else:
-            logger.write(src.printcolors.printc(src.OK_STATUS) + "\n", 4)
-            lines = p.stdout.readlines()
-            freq = lines[0][:-1].split(':')[-1].split('.')[0].strip()
-            nb_proc = len(lines) -1
-            memory = lines[-1].split(':')[-1].split()[0].strip()
-            memory = int(memory) / 1000
+        if not src.architecture.is_windows(): 
+            logger.write("    ssh %s " % (k + " ").ljust(20, '.'), 4)
+            logger.flush()
+
+            ssh_cmd = 'ssh -o "StrictHostKeyChecking no" %s %s' % (k, cmd)
+            p = subprocess.Popen(ssh_cmd, shell=True,
+                    stdin=subprocess.PIPE,
+                    stdout=subprocess.PIPE,
+                    stderr=subprocess.PIPE)
+            p.wait()
+
+            machine_access = (p.returncode == 0) 
+            if not machine_access:
+                logger.write(src.printcolors.printc(src.KO_STATUS) + "\n", 4)
+                logger.write("    " + src.printcolors.printcWarning(p.stderr.read()),
+                             2)
+            else:
+                logger.write(src.printcolors.printc(src.OK_STATUS) + "\n", 4)
+                lines = p.stdout.readlines()
+                freq = lines[0][:-1].split(':')[-1].split('.')[0].strip()
+                nb_proc = len(lines) -1
+                memory = lines[-1].split(':')[-1].split()[0].strip()
+                memory = int(memory) / 1000
 
             catalog.write("    <machine\n")
             catalog.write("        protocol=\"ssh\"\n")
             catalog.write("        nbOfNodes=\"1\"\n")
             catalog.write("        mode=\"interactif\"\n")
             catalog.write("        OS=\"LINUX\"\n")
-            catalog.write("        CPUFreqMHz=\"%s\"\n" % freq)
-            catalog.write("        nbOfProcPerNode=\"%s\"\n" % nb_proc)
-            catalog.write("        memInMB=\"%s\"\n" % memory)
+
+            if (not src.architecture.is_windows()) and machine_access:
+                catalog.write("        CPUFreqMHz=\"%s\"\n" % freq)
+                catalog.write("        nbOfProcPerNode=\"%s\"\n" % nb_proc)
+                catalog.write("        memInMB=\"%s\"\n" % memory)
+
             catalog.write("        userName=\"%s\"\n" % user)
             catalog.write("        name=\"%s\"\n" % k)
             catalog.write("        hostname=\"%s\"\n" % k)
@@ -414,7 +419,7 @@ def run(args, runner, logger):
 
     # if section APPLICATION.virtual_app does not exists create one
     if "virtual_app" not in runner.cfg.APPLICATION:
-        msg = _("The section APPLICATION.virtual_app is not defined in the product.")
+        msg = _("The section APPLICATION.virtual_app is not defined in the product. Use sat launcher in state")
         logger.write(src.printcolors.printcError(msg), 1)
         logger.write("\n", 1)
         return 1