Commit 8ce1edf8 authored by Emily Hanley's avatar Emily Hanley Committed by Commit Bot

Using bot_id from tasks/list query response instead of parsing for id

From what I can see, bot_id is a gauranteed field in the query response
vs assuming it comes back as a tag.

Bug: 831252
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I6cb0c48a1dce8ffcea35ce3ab65404366c450c9a
Reviewed-on: https://chromium-review.googlesource.com/1047065
Commit-Queue: Emily Hanley <eyaich@chromium.org>
Reviewed-by: default avatarMarc-Antoine Ruel <maruel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556440}
parent faf462c0
......@@ -222,9 +222,11 @@ class PerfDeviceTriggerer(base_test_triggerer.BaseTestTriggerer):
# We queried with a limit of 1 so we could only get back
# the most recent which is what we care about.
task = tasks[0]
if 'bot_id' in task:
return task['bot_id']
for tag in task['tags']:
if 'id' in tag:
return tag[len('id;'):]
if tag.startswith('id:'):
return tag[len('id:'):]
# No eligible shard for this bot
return None
......
......@@ -99,7 +99,7 @@ class UnitTest(unittest.TestCase):
for i in xrange(num_shards):
bot_id = previous_task_assignment_map.get(i)
files['base_trigger_dimensions%d.json' % file_index] = (
self.generate_last_task_to_shard_query_response(bot_id))
self.generate_last_task_to_shard_query_response(i, bot_id))
file_index = file_index + 1
for i in xrange(num_shards):
task = {
......@@ -120,9 +120,14 @@ class UnitTest(unittest.TestCase):
file_index = file_index + 1
return files
def generate_last_task_to_shard_query_response(self, bot_id):
def generate_last_task_to_shard_query_response(self, shard, bot_id):
if len(bot_id):
return {'items': [{'tags': [('id:%s' % bot_id)]}]}
# Test both cases where bot_id is present and you have to parse
# out of the tags.
if shard % 2:
return {'items': [{'bot_id': bot_id}]}
else:
return {'items': [{'tags': [('id:%s' % bot_id)]}]}
return {}
def generate_list_of_eligible_bots_query_response(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment