import paramiko
import src
-from _ast import Expression
STYLESHEET_GLOBAL = "jobs_global_report.xsl"
STYLESHEET_BOARD = "jobs_board_report.xsl"
parser = src.options.Options()
parser.add_option('n', 'name', 'string', 'jobs_cfg',
- _('The name of the config file that contains'
+ _('Mandatory: The name of the config file that contains'
' the jobs configuration'))
parser.add_option('o', 'only_jobs', 'list2', 'only_jobs',
_('Optional: the list of jobs to launch, by their name. '))
parser.add_option('i', 'input_boards', 'string', 'input_boards', _("Optional: "
"the path to csv file that contain "
"the expected boards."),"")
-parser.add_option('n', 'completion', 'boolean', 'no_label',
+parser.add_option('', 'completion', 'boolean', 'no_label',
_("Optional (internal use): do not print labels, Works only "
"with --list."),
False)
self.global_name + ".xml")
self.xml_global_file = src.xmlManager.XmlLogFile(xml_global_path,
"JobsReport")
+
+ # Find history for each job
+ self.history = {}
+ self.find_history(l_jobs, l_jobs_not_today)
+
# The xml files that corresponds to the boards.
# {name_board : xml_object}}
self.d_xml_board_files = {}
+
# Create the lines and columns
self.initialize_boards(l_jobs, l_jobs_not_today)
- # Find history for each job
- self.history = {}
- self.find_history(l_jobs, l_jobs_not_today)
# Write the xml file
self.update_xml_files(l_jobs)
# that will not be launched today
self.put_jobs_not_today(l_jobs_not_today, xml_jobs)
+ # add also the infos node
xml_file.add_simple_node("infos",
attrib={"name" : "last update",
"JobsCommandStatus" : "running"})
-
+
+ # and put the history node
+ history_node = xml_file.add_simple_node("history")
+ name_board = os.path.basename(xml_file.logFile)[:-len(".xml")]
+ # serach for board files
+ expression = "^[0-9]{8}_+[0-9]{6}_" + name_board + ".xml$"
+ oExpr = re.compile(expression)
+ # Get the list of xml borad files that are in the log directory
+ for file_name in os.listdir(self.xml_dir_path):
+ if oExpr.search(file_name):
+ date = os.path.basename(file_name).split("_")[0]
+ file_path = os.path.join(self.xml_dir_path, file_name)
+ src.xmlManager.add_simple_node(history_node,
+ "link",
+ text=file_path,
+ attrib={"date" : date})
+
+
# Find in each board the squares that needs to be filled regarding the
# input csv files but that are not covered by a today job
for board in self.d_input_boards.keys():
# Describes the command
def description():
return _("The jobs command launches maintenances that are described"
- " in the dedicated jobs configuration file.")
+ " in the dedicated jobs configuration file.\n\nexample:\nsat "
+ "jobs --name my_jobs --publish")
##
# Runs the command.