| 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 by the Apache v2.0 license that can be |
| 4 # found in the LICENSE file. | 4 # 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 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 from components import pubsub | 61 from components import pubsub |
| 62 from components import utils | 62 from components import utils |
| 63 from server import task_pack | 63 from server import task_pack |
| 64 | 64 |
| 65 | 65 |
| 66 # Maximum acceptable priority value, which is effectively the lowest priority. | 66 # Maximum acceptable priority value, which is effectively the lowest priority. |
| 67 MAXIMUM_PRIORITY = 255 | 67 MAXIMUM_PRIORITY = 255 |
| 68 | 68 |
| 69 | 69 |
| 70 # Enforced on both task request and bots. | 70 # Enforced on both task request and bots. |
| 71 DIMENSION_KEY_RE = ur'^[a-zA-Z\-\_]+$' | 71 DIMENSION_KEY_RE = ur'^[a-zA-Z\-\_\.]+$' |
| 72 | 72 |
| 73 | 73 |
| 74 # One day in seconds. Add 10s to account for small jitter. | 74 # One day in seconds. Add 10s to account for small jitter. |
| 75 _ONE_DAY_SECS = 24*60*60 + 10 | 75 _ONE_DAY_SECS = 24*60*60 + 10 |
| 76 | 76 |
| 77 | 77 |
| 78 # Seven day in seconds. Add 10s to account for small jitter. | 78 # Seven day in seconds. Add 10s to account for small jitter. |
| 79 _SEVEN_DAYS_SECS = 7*24*60*60 + 10 | 79 _SEVEN_DAYS_SECS = 7*24*60*60 + 10 |
| 80 | 80 |
| 81 | 81 |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 _put_request(request) | 648 _put_request(request) |
| 649 return request | 649 return request |
| 650 | 650 |
| 651 | 651 |
| 652 def validate_priority(priority): | 652 def validate_priority(priority): |
| 653 """Throws ValueError if priority is not a valid value.""" | 653 """Throws ValueError if priority is not a valid value.""" |
| 654 if 0 > priority or MAXIMUM_PRIORITY < priority: | 654 if 0 > priority or MAXIMUM_PRIORITY < priority: |
| 655 raise datastore_errors.BadValueError( | 655 raise datastore_errors.BadValueError( |
| 656 'priority (%d) must be between 0 and %d (inclusive)' % | 656 'priority (%d) must be between 0 and %d (inclusive)' % |
| 657 (priority, MAXIMUM_PRIORITY)) | 657 (priority, MAXIMUM_PRIORITY)) |
| OLD | NEW |