self.put_dir(sat_local_path, self.sat_path, filters = ['.git'])
# put the job configuration file in order to make it reachable
# on the remote machine
+ remote_job_file_name = ".%s" % os.path.basename(job_file)
self.sftp.put(job_file, os.path.join(self.sat_path,
- ".jobs_command_file.pyconf"))
+ remote_job_file_name))
except Exception as e:
res = str(e)
self._connection_successful = False
class Job(object):
'''Class to manage one job
'''
- def __init__(self, name, machine, application, board,
- commands, timeout, config, logger, after=None, prefix=None):
+ def __init__(self,
+ name,
+ machine,
+ application,
+ board,
+ commands,
+ timeout,
+ config,
+ job_file_path,
+ logger,
+ after=None,
+ prefix=None):
self.name = name
self.machine = machine
self.out = ""
self.err = ""
- name_remote_jobs_pyconf = ".jobs_command_file.pyconf"
+ self.name_remote_jobs_pyconf = ".%s" % os.path.basename(job_file_path)
self.commands = commands
self.command = (os.path.join(self.machine.sat_path, "sat") +
" -l " +
"list_log_files.txt") +
" job --jobs_config " +
os.path.join(self.machine.sat_path,
- ".jobs_command_file.pyconf") +
+ self.name_remote_jobs_pyconf) +
" --name " +
self.name)
if prefix:
cmmnds,
timeout,
self.runner.cfg,
+ self.job_file_path,
self.logger,
after = after,
prefix = prefix)
src.xmlManager.add_simple_node(xmlj,
"remote_log_file_path",
"nothing")
+ # Search for the test log if there is any
+ l_test_log_files = self.find_test_log(job.remote_log_files)
+ xml_test = src.xmlManager.add_simple_node(xmlj,
+ "test_log_file_path")
+ for test_log_path in l_test_log_files:
+ src.xmlManager.add_simple_node(xml_test, "path", test_log_path)
xmlafter = src.xmlManager.add_simple_node(xmlj, "after", job.after)
# get the job father
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")})
+ def find_test_log(self, l_remote_log_files):
+ '''Find if there is a test log (board) in the remote log files and
+ the path to it. There can be several test command, so the result is
+ a list.
+
+ :param l_remote_log_files List: the list of all remote log files
+ :return: the list of test log files path
+ :rtype: List
+ '''
+ res = []
+ for file_path in l_remote_log_files:
+ dirname = os.path.basename(os.path.dirname(file_path))
+ if dirname == "TEST":
+ res.append(file_path)
+ return res
def last_update(self, finish_status = "finished"):
'''update information about the jobs for the file xml_file