| 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 """Task entity that describe when a task is to be scheduled. | 6 """Task entity that describe when a task is to be scheduled. |
| 7 | 7 |
| 8 This module doesn't do the scheduling itself. It only describes the tasks ready | 8 This module doesn't do the scheduling itself. It only describes the tasks ready |
| 9 to be scheduled. | 9 to be scheduled. |
| 10 | 10 |
| 11 Graph of the schema: | 11 Graph of the schema: |
| 12 | 12 |
| 13 +--------Root---------+ | 13 +--------Root---------+ |
| 14 |TaskRequest | (task_request.py) | 14 |TaskRequest | (task_request.py) |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 too_long, | 453 too_long, |
| 454 deadline) | 454 deadline) |
| 455 | 455 |
| 456 | 456 |
| 457 def yield_expired_task_to_run(): | 457 def yield_expired_task_to_run(): |
| 458 """Yields all the expired TaskToRun still marked as available.""" | 458 """Yields all the expired TaskToRun still marked as available.""" |
| 459 now = utils.utcnow() | 459 now = utils.utcnow() |
| 460 for task in TaskToRun.query().filter(TaskToRun.queue_number > 0): | 460 for task in TaskToRun.query().filter(TaskToRun.queue_number > 0): |
| 461 if task.expiration_ts < now: | 461 if task.expiration_ts < now: |
| 462 yield task | 462 yield task |
| OLD | NEW |