| OLD | NEW |
| 1 from autotest_lib.client.common_lib import utils | 1 from autotest_lib.client.common_lib import utils |
| 2 | 2 |
| 3 class HostSchedulingUtility(object): | 3 class HostSchedulingUtility(object): |
| 4 """Interface to host availability information from the scheduler.""" | 4 """Interface to host availability information from the scheduler.""" |
| 5 def hosts_in_label(self, label_id): | 5 def hosts_in_label(self, label_id): |
| 6 """Return potentially usable hosts with the given label.""" | 6 """Return potentially usable hosts with the given label.""" |
| 7 raise NotImplementedError | 7 raise NotImplementedError |
| 8 | 8 |
| 9 | 9 |
| 10 def remove_host_from_label(self, host_id, label_id): | 10 def remove_host_from_label(self, host_id, label_id): |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 """Return true if this object can schedule the given queue entry. | 47 """Return true if this object can schedule the given queue entry. |
| 48 | 48 |
| 49 At most one MetahostScheduler should return true for any given entry. | 49 At most one MetahostScheduler should return true for any given entry. |
| 50 | 50 |
| 51 @param queue_entry: a HostQueueEntry DBObject | 51 @param queue_entry: a HostQueueEntry DBObject |
| 52 """ | 52 """ |
| 53 raise NotImplementedError | 53 raise NotImplementedError |
| 54 | 54 |
| 55 | 55 |
| 56 def schedule_metahost(self, queue_entry, scheduling_utility): | 56 def schedule_metahost(self, queue_entry, scheduling_utility): |
| 57 """Schedule the given queue entry, if possible. | 57 """Schedule the given queue entry, if possible. |
| 58 | 58 |
| 59 This method should make necessary database changes culminating in | 59 This method should make necessary database changes culminating in |
| 60 assigning a host to the given queue entry in the database. It may | 60 assigning a host to the given queue entry in the database. It may |
| 61 take no action if no host can be assigned currently. | 61 take no action if no host can be assigned currently. |
| 62 | 62 |
| 63 @param queue_entry: a HostQueueEntry DBObject | 63 @param queue_entry: a HostQueueEntry DBObject |
| 64 @param scheduling_utility: a HostSchedulingUtility object | 64 @param scheduling_utility: a HostSchedulingUtility object |
| 65 """ | 65 """ |
| 66 raise NotImplementedError | 66 raise NotImplementedError |
| 67 | 67 |
| 68 | 68 |
| 69 def recovery_on_startup(self): | 69 def recovery_on_startup(self): |
| 70 """Perform any necessary recovery upon scheduler startup.""" | 70 """Perform any necessary recovery upon scheduler startup.""" |
| 71 pass | 71 pass |
| 72 | 72 |
| 73 | 73 |
| 74 def tick(self): | 74 def tick(self): |
| 75 """Called once per scheduler cycle; any actions are allowed.""" | 75 """Called once per scheduler cycle; any actions are allowed.""" |
| 76 pass | 76 pass |
| (...skipping 22 matching lines...) Expand all Loading... |
| 99 | 99 |
| 100 # Remove the host from our cached internal state before returning | 100 # Remove the host from our cached internal state before returning |
| 101 scheduling_utility.remove_host_from_label(host_id, label_id) | 101 scheduling_utility.remove_host_from_label(host_id, label_id) |
| 102 host = scheduling_utility.pop_host(host_id) | 102 host = scheduling_utility.pop_host(host_id) |
| 103 queue_entry.set_host(host) | 103 queue_entry.set_host(host) |
| 104 return | 104 return |
| 105 | 105 |
| 106 | 106 |
| 107 def get_metahost_schedulers(): | 107 def get_metahost_schedulers(): |
| 108 return [LabelMetahostScheduler()] | 108 return [LabelMetahostScheduler()] |
| OLD | NEW |