def submit_job(self):
"""Submit the job to qsub, returns job_id."""
self.logger.info('Submitting job ...')
job_script_path = self._get_job_script_path()
arg_list = self._build_qsub_args()
arg_list.append(job_script_path)
self.logger.debug('arg_liste: {}'.format(arg_list))
try:
self.logger.debug(
'{} {}'.format(self.cfg.path_qsub, arg_list)
)
# get stating time and convert
self.time_stamp_jobstart = int(time.time()) * 1000
self.logger.debug(
'stat time stamp: {}'.format(self.time_stamp_jobstart)
)
# Job submit
ssh_output = self.ssh_host(self.cfg.path_qsub, *arg_list)
# searching job id
for line in ssh_output:
self.logger.debug('searching for job id in \n{}'.format(line))
if "hlrs.de" in line:
self.logger.debug('possible job id found: {}'.format(line))
self.job_id = str(line)
if self.cfg.grafana:
self.logger.info(
'Job performance data at:\n'
'{}var-JobId=snapTask-{}-{}&'
'from={}&'
'to=now'.format(
self.cfg.grafana_base_string,
self.cfg.user_name,
self.job_id.rstrip(),
self.time_stamp_jobstart
)
)
return
self.logger.error(
'no job id found in \n{}\nexiting!!!'.format(ssh_output)
)
exit(1)
except ErrorReturnCode as e:
self.logger.error('\nError in ssh call:\n{}'.format(e))
print e.stderr
exit(1)
connection.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录