+ :param l_jobs List: the list of jobs to run today
+ :param l_jobs_not_today List: the list of jobs that do not run today
+ """
+ # load the all the history
+ expression = "^[0-9]{8}_+[0-9]{6}_" + self.global_name + ".xml$"
+ oExpr = re.compile(expression)
+ # Get the list of global xml that are in the log directory
+ l_globalxml = []
+ 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)
+ 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:
+ l_links = []
+ for global_xml in l_globalxml:
+ date = os.path.basename(global_xml.filePath).split("_")[0]
+ global_root_node = global_xml.xmlroot.find("jobs")
+ job_node = src.xmlManager.find_node_by_attrib(
+ global_root_node,
+ "job",
+ "name",
+ job.name)
+ if job_node:
+ if job_node.find("remote_log_file_path") is not None:
+ link = job_node.find("remote_log_file_path").text
+ res_job = job_node.find("res").text
+ if link != "nothing":
+ l_links.append((date, res_job, link))
+ l_links = sorted(l_links, reverse=True)
+ self.history[job.name] = l_links
+
+ def put_jobs_not_today(self, l_jobs_not_today, xml_node_jobs):
+ '''Get all the first information needed for each file and write the
+ first version of the files
+
+ :param xml_node_jobs etree.Element: the node corresponding to a job
+ :param l_jobs_not_today List: the list of jobs that do not run today
+ '''
+ for job in l_jobs_not_today:
+ xmlj = src.xmlManager.add_simple_node(xml_node_jobs,
+ "job",
+ attrib={"name" : job.name})
+ src.xmlManager.add_simple_node(xmlj, "application", job.application)
+ src.xmlManager.add_simple_node(xmlj,
+ "distribution",
+ job.machine.distribution)
+ src.xmlManager.add_simple_node(xmlj, "board", job.board)
+ src.xmlManager.add_simple_node(xmlj,
+ "commands", " ; ".join(job.commands))
+ src.xmlManager.add_simple_node(xmlj, "state", "Not today")
+ src.xmlManager.add_simple_node(xmlj, "machine", job.machine.name)
+ src.xmlManager.add_simple_node(xmlj, "host", job.machine.host)
+ src.xmlManager.add_simple_node(xmlj, "port", str(job.machine.port))
+ src.xmlManager.add_simple_node(xmlj, "user", job.machine.user)
+ src.xmlManager.add_simple_node(xmlj, "sat_path",
+ job.machine.sat_path)
+ xml_history = src.xmlManager.add_simple_node(xmlj, "history")
+ for i, (date, res_job, link) in enumerate(self.history[job.name]):
+ if i==0:
+ # tag the first one (the last one)
+ src.xmlManager.add_simple_node(xml_history,
+ "link",
+ text=link,
+ attrib={"date" : date,
+ "res" : res_job,
+ "last" : "yes"})
+ else:
+ src.xmlManager.add_simple_node(xml_history,
+ "link",
+ text=link,
+ attrib={"date" : date,
+ "res" : res_job,
+ "last" : "no"})
+
+ def parse_csv_boards(self, today):
+ """ Parse the csv file that describes the boards to produce and fill
+ the dict d_input_boards that contain the csv file contain