def _read_task_metadata(self, task_dir):
"""Read the meta file containing core fields for dstat."""
try:
with open(os.path.join(task_dir, 'meta.yaml'), 'r') as f:
meta = yaml.load('\n'.join(f.readlines()))
# Make sure that create-time string is turned into a datetime
meta['create-time'] = datetime.strptime(meta['create-time'],
'%Y-%m-%d %H:%M:%S.%f')
return meta
except (IOError, OSError):
# lookup_job_tasks may try to read the task metadata as a task is being
# created. In that case, just catch the exception and return None.
return None
评论列表
文章目录