Do not fail perf upload when try commit cannot be found
This may happen if the gerrit CL correspondingto a try commit is deleted.
Change-Id: Icbb363aed9114f5cf06ffc730c9bdfbfb8e61441
diff --git a/tools/historic_run.py b/tools/historic_run.py
index 9de2e91..81b9b52 100755
--- a/tools/historic_run.py
+++ b/tools/historic_run.py
@@ -130,8 +130,11 @@
try:
commit_timestamp_raw = subprocess.check_output(commit_timestamp_cmd)
except subprocess.CalledProcessError as e:
- # Try to fetch the hash. This may be needed for try commits.
- subprocess.check_output(['git', 'fetch', 'origin', hash])
+ try:
+ # Try to fetch the hash. This may be needed for try commits.
+ subprocess.check_output(['git', 'fetch', 'origin', hash])
+ except subprocess.CalledProcessError as e:
+ return None
commit_timestamp_raw = subprocess.check_output(commit_timestamp_cmd)
commit_timestamp_str = commit_timestamp_raw.decode('utf-8').strip().splitlines()[-1]
commit_timestamp = int(commit_timestamp_str)
diff --git a/tools/upload_benchmark_data_to_google_storage.py b/tools/upload_benchmark_data_to_google_storage.py
index e975049..67d984e 100755
--- a/tools/upload_benchmark_data_to_google_storage.py
+++ b/tools/upload_benchmark_data_to_google_storage.py
@@ -117,7 +117,8 @@
try_hash = key.split('/')[3]
if try_hash not in seen_try_hashes:
try_commit = historic_run.git_commit_from_hash(try_hash)
- try_commits.append(try_commit)
+ if try_commit is not None:
+ try_commits.append(try_commit)
seen_try_hashes.add(try_hash)
return try_commits