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 by the Apache v2.0 license that can be | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
4 # found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
5 | 5 |
6 """Tasks definition. | 6 """Tasks definition. |
7 | 7 |
8 Each user request creates a new TaskRequest. The TaskRequest instance saves the | 8 Each user request creates a new TaskRequest. The TaskRequest instance saves the |
9 metadata of the request, e.g. who requested it, when why, etc. It links to the | 9 metadata of the request, e.g. who requested it, when why, etc. It links to the |
10 actual data of the request in a TaskProperties. The TaskProperties represents | 10 actual data of the request in a TaskProperties. The TaskProperties represents |
11 everything needed to run the task. | 11 everything needed to run the task. |
12 | 12 |
13 This means if two users request an identical task, it can be deduped | 13 This means if two users request an identical task, it can be deduped |
14 accordingly and efficiently by the scheduler. | 14 accordingly and efficiently by the scheduler. |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 _put_request(request) | 756 _put_request(request) |
757 return request | 757 return request |
758 | 758 |
759 | 759 |
760 def validate_priority(priority): | 760 def validate_priority(priority): |
761 """Throws ValueError if priority is not a valid value.""" | 761 """Throws ValueError if priority is not a valid value.""" |
762 if 0 > priority or MAXIMUM_PRIORITY < priority: | 762 if 0 > priority or MAXIMUM_PRIORITY < priority: |
763 raise datastore_errors.BadValueError( | 763 raise datastore_errors.BadValueError( |
764 'priority (%d) must be between 0 and %d (inclusive)' % | 764 'priority (%d) must be between 0 and %d (inclusive)' % |
765 (priority, MAXIMUM_PRIORITY)) | 765 (priority, MAXIMUM_PRIORITY)) |
OLD | NEW |