:return: (the output of the kill, the error of the kill)
:rtype: (str, str)
'''
-
- pids = self.get_pids()
+ try:
+ pids = self.get_pids()
+ except:
+ return ("Unable to get the pid of the command.", "")
+
cmd_kill = " ; ".join([("kill -2 " + pid) for pid in pids])
(_, out_kill, err_kill) = self.machine.exec_command(cmd_kill,
self.logger)
time.sleep(wait)
- return (out_kill, err_kill)
+ return (out_kill.read().decode(), err_kill.read().decode())
def has_begun(self):
'''Returns True if the job has already begun
self._has_finished = True
self._has_timouted = True
self._Tf = time.time()
- self.get_pids()
(out_kill, _) = self.kill_remote_process()
- self.out += "TIMEOUT \n" + out_kill.read().decode()
+ self.out += "TIMEOUT \n" + out_kill
self.err += "TIMEOUT : %s seconds elapsed\n" % str(self.timeout)
try:
self.get_log_files()
except Exception as e:
- self.err += _("Unable to get remote log files: %s" % e)
+ # The 2 following lines must be suppressed after the bug is fixed
+ print("The error type: ")
+ print(type(e))
+ print("The error: ")
+ print(e)
+ print("Local scope:")
+ print(dir())
+ print("The str type: ")
+ print(type(str))
+ print("str: ")
+ print(str)
+ self.err += _("Unable to get remote log files!")
def total_duration(self):
"""Give the total duration of the job
msg = _("WARNING: The job \"%(job_name)s\" requires the "
"machine \"%(machine_name)s\" but this machine "
"is not defined in the configuration file.\n"
- "The job will not be launched")
- self.logger.write(src.printcolors.printcWarning(msg))
+ "The job will not be launched\n")
+ self.logger.write(src.printcolors.printcWarning(
+ msg % {"job_name" : job_def.name,
+ "machine_name" : name_machine}))
+ continue
a_job = self.define_job(job_def, a_machine)
continue
for board in self.d_xml_board_files:
if board_job == board:
- if distrib is not None and distrib not in d_dist[board]:
+ if (distrib not in [None, ''] and
+ distrib not in d_dist[board]):
d_dist[board].append(distrib)
src.xmlManager.add_simple_node(
self.d_xml_board_files[board].xmlroot.find(
attrib={"name" : distrib})
if board_job == board:
- if (application is not None and
+ if (application not in [None, ''] and
application not in d_application[board]):
d_application[board].append(application)
src.xmlManager.add_simple_node(
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 config_file in options.jobs_cfg:
found, file_jobs_cfg = get_config_file_path(config_file, l_cfg_dir)
if not found:
- msg = _("The file configuration %(name_file)s was not found."
+ msg = _("The file configuration %s was not found."
"\nUse the --list option to get the "
"possible files." % config_file)
- src.printcolors.printcError(msg)
+ logger.write("%s\n" % src.printcolors.printcError(msg), 1)
return 1
l_conf_files_path.append(file_jobs_cfg)
# Read the config that is in the file
f = file( path_pyconf , 'w')
config_jobs.__save__(f)
+ # log the paramiko problems
+ paramiko_log_dir_path = os.path.join(runner.cfg.USER.log_dir, "JOBS")
+ src.ensure_path_exists(paramiko_log_dir_path)
+ paramiko.util.log_to_file(os.path.join(paramiko_log_dir_path,
+ logger.txtFileName))
+
# Initialization
today_jobs = Jobs(runner,
logger,