Salome HOME
sat jobs: for sml file publish, create also a prefixed file (by date_hour_) in order...
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Mon, 26 Sep 2016 14:33:24 +0000 (16:33 +0200)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Mon, 26 Sep 2016 14:33:24 +0000 (16:33 +0200)
commands/jobs.py
commands/test.py
salomeTools.py

index 6fd6cedbb60985f9a0389639256f879b816cb689..90be9793052c0f5eff3c6dde245124496bd0ca2f 100644 (file)
@@ -441,6 +441,8 @@ class Job(object):
         """In case of a failing job, one has to cancel every job that depend 
            on it. This method put the job as failed and will not be executed.
         """
+        if self.cancelled:
+            return
         self._has_begun = True
         self._has_finished = True
         self.cancelled = True
@@ -1024,7 +1026,7 @@ class Gui(object):
        see the jobs states
     '''
    
-    def __init__(self, xml_dir_path, l_jobs, l_jobs_not_today, file_boards=""):
+    def __init__(self, xml_dir_path, l_jobs, l_jobs_not_today, prefix, file_boards=""):
         '''Initialization
         
         :param xml_dir_path str: The path to the directory where to put 
@@ -1034,6 +1036,9 @@ class Gui(object):
         :param file_boards str: the file path from which to read the
                                    expected boards
         '''
+        # The prefix to add to the xml files : date_hour
+        self.prefix = prefix
+        
         # The path of the csv files to read to fill the expected boards
         self.file_boards = file_boards
         
@@ -1391,14 +1396,26 @@ class Gui(object):
                         attrib={"JobsCommandStatus" : finish_status})
         # Write the file
         self.write_xml_files()
-    
+
+    def write_xml_file(self, xml_file, stylesheet):
+        ''' Write one xml file and the same file with prefix
+        '''
+        xml_file.write_tree(stylesheet)
+        file_path = xml_file.logFile
+        file_dir = os.path.dirname(file_path)
+        file_name = os.path.basename(file_path)
+        file_name_with_prefix = self.prefix + "_" + file_name
+        xml_file.write_tree(stylesheet, os.path.join(file_dir,
+                                                     file_name_with_prefix))
+        
     def write_xml_files(self):
         ''' Write the xml files   
         '''
-        self.xml_global_file.write_tree(STYLESHEET_GLOBAL)
+        self.write_xml_file(self.xml_global_file, STYLESHEET_GLOBAL)
         for xml_file in self.d_xml_board_files.values():
-            xml_file.write_tree(STYLESHEET_BOARD)
-        
+            self.write_xml_file(xml_file, STYLESHEET_BOARD)
+
+
 ##
 # Describes the command
 def description():
@@ -1495,6 +1512,7 @@ def run(args, runner, logger):
         gui = Gui(runner.cfg.USER.log_dir,
                   today_jobs.ljobs,
                   today_jobs.ljobs_not_today,
+                  runner.cfg.VARS.datehour,
                   file_boards = options.input_boards)
         
         # Display the list of the xml files
index 1c1aa7afe6a806d6eb4ed21aacd21d7aab38f9e6..3b17e55ac31b88cf543351ac4eadc74f6ca5b817 100644 (file)
@@ -537,9 +537,6 @@ def run(args, runner, logger):
                     "board",
                     retcode,
                     "Click on the link to get the detailed test results")
-    
-    if retcode != 0:
-        retcode = 1
-    
+
     return retcode
 
index 34ee85c9a761df5e93f1cc3440165abb7a356b19..4b25cfa68fdd9ae902fd8f5ced8d13bc7c2b624b 100755 (executable)
@@ -292,7 +292,7 @@ class Sat(object):
                     logger_command.end_write(
                                         {"launchedCommand" : launchedCommand})
                     
-                    if res is None:
+                    if res != 0:
                         res = 1
                     # If the logs_paths_in_file was called, write the result
                     # and log files in the given file path