Skip to content

Commit ba67a51

Browse files
authored
Merge pull request #8978 from palimondo/SR-4659
2 parents 2e6bdbc + d773247 commit ba67a51

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
@@ -135,6 +135,14 @@ def get_current_git_branch(git_repo_path):
135135
'--abbrev-ref', 'HEAD'], stderr=subprocess.STDOUT).strip()
136136

137137

138+
def get_git_head_ID(git_repo_path):
139+
"""Return the short identifier for the HEAD commit of the repo
140+
`git_repo_path`"""
141+
return subprocess.check_output(
142+
['git', '-C', git_repo_path, 'rev-parse',
143+
'--short', 'HEAD'], stderr=subprocess.STDOUT).strip()
144+
145+
138146
def log_results(log_directory, driver, formatted_output, swift_repo=None):
139147
"""Log `formatted_output` to a branch specific directory in
140148
`log_directory`
@@ -143,6 +151,10 @@ def log_results(log_directory, driver, formatted_output, swift_repo=None):
143151
branch = get_current_git_branch(swift_repo)
144152
except (OSError, subprocess.CalledProcessError):
145153
branch = None
154+
try:
155+
head_ID = '-' + get_git_head_ID(swift_repo)
156+
except (OSError, subprocess.CalledProcessError):
157+
head_ID = ''
146158
timestamp = time.strftime("%Y%m%d%H%M%S", time.localtime())
147159
if branch:
148160
output_directory = os.path.join(log_directory, branch)
@@ -154,7 +166,7 @@ def log_results(log_directory, driver, formatted_output, swift_repo=None):
154166
except OSError:
155167
pass
156168
log_file = os.path.join(output_directory,
157-
driver_name + '-' + timestamp + '.log')
169+
driver_name + '-' + timestamp + head_ID + '.log')
158170
print('Logging results to: %s' % log_file)
159171
with open(log_file, 'w') as f:
160172
f.write(formatted_output)

0 commit comments

Comments
 (0)