Salome HOME
add the generate command
[tools/sat.git] / commands / job.py
index 8d1a63b90f265791db8817da501567d4439df9ff..e78a298bbd145e67cf9bd5de0c9b92d31852bb41 100644 (file)
@@ -43,13 +43,8 @@ def run(args, runner, logger):
     
     # Parse the options
     (options, args) = parser.parse_args(args)
-      
-    jobs_cfg_files_dir = runner.cfg.SITE.jobs.config_path
-    
-    l_cfg_dir = [jobs_cfg_files_dir, os.path.join(runner.cfg.VARS.datadir, "jobs")]
-    
-    # Make sure the path to the jobs config files directory exists 
-    src.ensure_path_exists(jobs_cfg_files_dir)   
+         
+    l_cfg_dir = runner.cfg.PATHS.JOBPATH
     
     # Make sure the jobs_config option has been called
     if not options.jobs_cfg:
@@ -121,18 +116,26 @@ def run(args, runner, logger):
                      src.printcolors.printcLabel(command) + " ", 3)
         logger.write("." * (len_max_command - len(command)) + " ", 3)
         logger.flush()
-        # Execute the command
-        code = sat_command(end_cmd,
-                           batch = True,
-                           verbose = 0,
-                           logger_add_link = logger)
+        
+        error = ""
+        try:
+            # Execute the command
+            code = sat_command(end_cmd,
+                               batch = True,
+                               verbose = 0,
+                               logger_add_link = logger)
+        except Exception as e:
+            code = 1
+            error = str(e)
+
         # Print the status of the command
         if code == 0:
             nb_pass += 1
             logger.write('%s\n' % src.printcolors.printc(src.OK_STATUS), 3)
         else:
             res = 1
-            logger.write('%s\n' % src.printcolors.printc(src.KO_STATUS), 3)
+            logger.write('%s %s\n' % (src.printcolors.printc(src.KO_STATUS),
+                                      error), 3)
     
     # Print the final state
     if res == 0: