OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 # Copyright 2014 The LUCI Authors. All rights reserved. | 2 # Copyright 2014 The LUCI Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
5 | 5 |
6 """OS specific utility functions. | 6 """OS specific utility functions. |
7 | 7 |
8 Includes code: | 8 Includes code: |
9 - to declare the current system this code is running under. | 9 - to declare the current system this code is running under. |
10 - to run a command on user login. | 10 - to run a command on user login. |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 """ | 803 """ |
804 dimensions = get_dimensions() | 804 dimensions = get_dimensions() |
805 if not devices: | 805 if not devices: |
806 return dimensions | 806 return dimensions |
807 | 807 |
808 # Pop a few dimensions otherwise there will be too many dimensions. | 808 # Pop a few dimensions otherwise there will be too many dimensions. |
809 del dimensions[u'cpu'] | 809 del dimensions[u'cpu'] |
810 del dimensions[u'cores'] | 810 del dimensions[u'cores'] |
811 del dimensions[u'gpu'] | 811 del dimensions[u'gpu'] |
812 dimensions.pop(u'machine_type') | 812 dimensions.pop(u'machine_type') |
| 813 dimensions.pop(u'ssd', None) |
813 | 814 |
814 # Each key in the following dict is a dimension and its value is the list of | 815 # Each key in the following dict is a dimension and its value is the list of |
815 # all possible device properties that can define that dimension. | 816 # all possible device properties that can define that dimension. |
816 # TODO(bpastene) Make sure all the devices use the same board and OS. | 817 # TODO(bpastene) Make sure all the devices use the same board and OS. |
817 dimension_properties = { | 818 dimension_properties = { |
818 u'device_os': ['build.id'], | 819 u'device_os': ['build.id'], |
819 u'device_type': ['build.product', 'product.board', 'product.device'], | 820 u'device_type': ['build.product', 'product.board', 'product.device'], |
820 } | 821 } |
821 for dim in dimension_properties: | 822 for dim in dimension_properties: |
822 dimensions[dim] = set() | 823 dimensions[dim] = set() |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 | 1292 |
1292 | 1293 |
1293 def trim_rolled_log(name): | 1294 def trim_rolled_log(name): |
1294 try: | 1295 try: |
1295 for item in glob.iglob('%s.??' % name): | 1296 for item in glob.iglob('%s.??' % name): |
1296 os.remove(item) | 1297 os.remove(item) |
1297 for item in glob.iglob('%s.???' % name): | 1298 for item in glob.iglob('%s.???' % name): |
1298 os.remove(item) | 1299 os.remove(item) |
1299 except Exception as e: | 1300 except Exception as e: |
1300 logging.exception('trim_rolled_log(%s) failed: %s', name, e) | 1301 logging.exception('trim_rolled_log(%s) failed: %s', name, e) |
OLD | NEW |