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

Side by Side Diff: build/android/pylib/device/device_list.py

Issue 301183004: Android: adds device affinity for perf tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """A module to keep track of devices across builds."""
jbudorick 2014/06/03 13:52:52 I'm not sure that this module goes far enough - it
6
7 import os
8
9 LAST_DEVICES_FILENAME = '.last_devices'
10 LAST_MISSING_DEVICES_FILENAME = '.last_missing'
11
12
13 def GetDeviceList(file_name):
jbudorick 2014/06/03 13:52:52 This should be renamed to avoid confusion with Adb
bulach 2014/06/03 14:25:52 good point! Get|WritePersistentDeviceList.
14 """Returns a list of devices.
15
16 Args:
17 file_name: the file name containing a list of devices.
18
19 Returns: List of device serial numbers that were on the bot.
20 """
21 devices = []
22 try:
23 with open(file_name) as f:
24 devices = f.read().splitlines()
25 except IOError:
26 # Ignore error, file might not exist
27 pass
jbudorick 2014/06/03 13:52:52 This should log something. Not an error, obviously
bulach 2014/06/03 14:25:52 good catch.. the exception shouldn't be handled he
28 return devices
29
30
31 def WriteDeviceList(file_name, device_list):
32 path = os.path.dirname(file_name)
33 if not os.path.exists(path):
34 os.makedirs(path)
35 with open(file_name, 'w') as f:
36 f.write('\n'.join(set(device_list)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698