From: Kyr Shatskyy Date: Tue, 12 May 2020 15:02:26 +0000 (+0200) Subject: suite/run: include 'user' and 'timestamp' in job conf X-Git-Tag: 1.1.0~60^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d57a271b5feab2e4fe2c152d1bdea954f379a399;p=teuthology.git suite/run: include 'user' and 'timestamp' in job conf This is useful to avoid unnecessary parsing of job name in order to get run user and timestamp. Signed-off-by: Kyr Shatskyy --- diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index 63169910bf..73f7b13448 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -32,6 +32,7 @@ class Run(object): __slots__ = ( 'args', 'name', 'base_config', 'suite_repo_path', 'base_yaml_paths', 'base_args', 'package_versions', 'kernel_dict', 'config_input', + 'timestamp', 'user', ) def __init__(self, args): @@ -39,6 +40,11 @@ class Run(object): args must be a config.YamlConfig object """ self.args = args + # We assume timestamp is a datetime.datetime object + self.timestamp = self.args.timestamp or \ + datetime.now().strftime('%Y-%m-%d_%H:%M:%S') + self.user = self.args.user or pwd.getpwuid(os.getuid()).pw_name + self.name = self.make_run_name() if self.args.ceph_repo: @@ -60,16 +66,15 @@ class Run(object): Generate a run name. A run name looks like: teuthology-2014-06-23_19:00:37-rados-dumpling-testing-basic-plana """ - user = self.args.user or pwd.getpwuid(os.getuid()).pw_name - # We assume timestamp is a datetime.datetime object - timestamp = self.args.timestamp or \ - datetime.now().strftime('%Y-%m-%d_%H:%M:%S') - worker = util.get_worker(self.args.machine_type) return '-'.join( [ - user, str(timestamp), self.args.suite, self.args.ceph_branch, - self.args.kernel_branch or '-', self.args.kernel_flavor, worker + self.user, + str(self.timestamp), + self.args.suite, + self.args.ceph_branch, + self.args.kernel_branch or '-', + self.args.kernel_flavor, worker ] ).replace('/', ':') @@ -309,6 +314,8 @@ class Run(object): conf_dict.update(self.kernel_dict) job_config = JobConfig.from_dict(conf_dict) job_config.name = self.name + job_config.user = self.user + job_config.timestamp = self.timestamp job_config.priority = self.args.priority if self.args.email: job_config.email = self.args.email