Skip to content

Commit d773247

Browse files
committed
Fix SR-4659 Benchmark logs should be tied to tested tree version
1 parent f3f8b62 commit d773247

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

benchmark/scripts/Benchmark_Driver

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ def get_current_git_branch(git_repo_path):
130130
'--abbrev-ref', 'HEAD'], stderr=subprocess.STDOUT).strip()
131131

132132

133+
def get_git_head_ID(git_repo_path):
134+
"""Return the short identifier for the HEAD commit of the repo
135+
`git_repo_path`"""
136+
return subprocess.check_output(
137+
['git', '-C', git_repo_path, 'rev-parse',
138+
'--short', 'HEAD'], stderr=subprocess.STDOUT).strip()
139+
140+
133141
def log_results(log_directory, driver, formatted_output, swift_repo=None):
134142
"""Log `formatted_output` to a branch specific directory in
135143
`log_directory`
@@ -138,6 +146,10 @@ def log_results(log_directory, driver, formatted_output, swift_repo=None):
138146
branch = get_current_git_branch(swift_repo)
139147
except (OSError, subprocess.CalledProcessError):
140148
branch = None
149+
try:
150+
head_ID = '-' + get_git_head_ID(swift_repo)
151+
except (OSError, subprocess.CalledProcessError):
152+
head_ID = ''
141153
timestamp = time.strftime("%Y%m%d%H%M%S", time.localtime())
142154
if branch:
143155
output_directory = os.path.join(log_directory, branch)
@@ -149,7 +161,7 @@ def log_results(log_directory, driver, formatted_output, swift_repo=None):
149161
except OSError:
150162
pass
151163
log_file = os.path.join(output_directory,
152-
driver_name + '-' + timestamp + '.log')
164+
driver_name + '-' + timestamp + head_ID + '.log')
153165
print('Logging results to: %s' % log_file)
154166
with open(log_file, 'w') as f:
155167
f.write(formatted_output)

0 commit comments

Comments
 (0)