From: Serge Rehbinder Date: Tue, 29 Nov 2016 08:55:27 +0000 (+0100) Subject: bug fix in jobs X-Git-Tag: 5.0.0a1~38^2~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=db7d151c33ce031666dd7f8a39a0baaf458f77ed;p=tools%2Fsat.git bug fix in jobs --- diff --git a/commands/config.py b/commands/config.py index af657c9..9023b07 100644 --- a/commands/config.py +++ b/commands/config.py @@ -285,7 +285,7 @@ class ConfigManager: if not os.path.exists(project_pyconf_path): msg = _("WARNING: The project file %s cannot be found. " "It will be ignored\n" % project_pyconf_path) - sys.stdout.write(src.printcolors.printcWarning(msg)) + sys.stdout.write(msg) continue project_name = os.path.basename( project_pyconf_path)[:-len(".pyconf")] diff --git a/commands/jobs.py b/commands/jobs.py index ce9a19d..fb8497e 100644 --- a/commands/jobs.py +++ b/commands/jobs.py @@ -267,7 +267,8 @@ class Job(object): self.out = "" self.err = "" - + + name_remote_jobs_pyconf = ".jobs_command_file.pyconf" self.commands = commands self.command = (os.path.join(self.machine.sat_path, "sat") + " -l " + @@ -1043,7 +1044,13 @@ class Gui(object): see the jobs states ''' - def __init__(self, xml_dir_path, l_jobs, l_jobs_not_today, prefix, file_boards=""): + def __init__(self, + xml_dir_path, + l_jobs, + l_jobs_not_today, + prefix, + logger, + file_boards=""): '''Initialization :param xml_dir_path str: The path to the directory where to put @@ -1053,6 +1060,9 @@ class Gui(object): :param file_boards str: the file path from which to read the expected boards ''' + # The logging instance + self.logger = logger + # The prefix to add to the xml files : date_hour self.prefix = prefix @@ -1084,7 +1094,7 @@ class Gui(object): # Create the lines and columns self.initialize_boards(l_jobs, l_jobs_not_today) - + # Write the xml file self.update_xml_files(l_jobs) @@ -1277,8 +1287,15 @@ class Gui(object): for file_name in os.listdir(self.xml_dir_path): if oExpr.search(file_name): file_path = os.path.join(self.xml_dir_path, file_name) - global_xml = src.xmlManager.ReadXmlFile(file_path) - l_globalxml.append(global_xml) + try: + global_xml = src.xmlManager.ReadXmlFile(file_path) + l_globalxml.append(global_xml) + except Exception as e: + msg = _("\nWARNING: the file %s can not be read, it will be " + "ignored\n%s" % (file_path, e)) + self.logger.write("%s\n" % src.printcolors.printcWarning( + msg), 5) + # Construct the dictionnary self.history for job in l_jobs + l_jobs_not_today: @@ -1652,6 +1669,7 @@ def run(args, runner, logger): today_jobs.ljobs, today_jobs.ljobs_not_today, runner.cfg.VARS.datehour, + logger, file_boards = options.input_boards) logger.write(src.printcolors.printcSuccess("OK"), 5) @@ -1707,4 +1725,4 @@ def run(args, runner, logger): today_jobs.gui.last_update() # Output the results today_jobs.write_all_results() - return res \ No newline at end of file + return res