Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Unified Diff: telemetry/telemetry/benchmark_runner.py

Issue 2408783002: Factoring out device affinity generation to be used in swarming (Closed)
Patch Set: Pulling out into a utility Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | telemetry/telemetry/util/bot_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/benchmark_runner.py
diff --git a/telemetry/telemetry/benchmark_runner.py b/telemetry/telemetry/benchmark_runner.py
index 3828bad16db2fd99cd99949992eba94926e5cd7d..a3387d72c4aede1549172245469e194a4f8a6812 100644
--- a/telemetry/telemetry/benchmark_runner.py
+++ b/telemetry/telemetry/benchmark_runner.py
@@ -8,7 +8,6 @@ Handles benchmark configuration, but all the logic for
actually running the benchmark is in Benchmark and PageRunner."""
import argparse
-import hashlib
import json
import logging
import os
@@ -23,6 +22,7 @@ from telemetry.internal.util import binary_manager
from telemetry.internal.util import command_line
from telemetry.internal.util import ps_util
from telemetry.util import matching
+from telemetry.util import bot_utils
# Right now, we only have one of each of our power perf bots. This means that
@@ -358,18 +358,7 @@ def _GetJsonBenchmarkList(possible_browser, possible_reference_browser,
base_name]
perf_dashboard_id = base_name
- # Based on the current timings, we shift the result of the hash function to
- # achieve better load balancing. Those shift values are to be revised when
- # necessary. The shift value is calculated such that the total cycle time
- # is minimized.
- hash_shift = {
- 2 : 47, # for old desktop configurations with 2 slaves
- 5 : 56, # for new desktop configurations with 5 slaves
- 21 : 43 # for Android 3 slaves 7 devices configurations
- }
- shift = hash_shift.get(num_shards, 0)
- base_name_hash = hashlib.sha1(base_name).hexdigest()
- device_affinity = (int(base_name_hash, 16) >> shift) % num_shards
+ device_affinity = bot_utils.GetDeviceAffinity(num_shards, base_name)
output['steps'][base_name] = {
'cmd': ' '.join(base_cmd + [
« no previous file with comments | « no previous file | telemetry/telemetry/util/bot_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698