Revert "[autotest] Restore from inconsistent state after the scheduler was interrupted."
This reverts commit b7c842f8c8ba135bb03a0862ac0c880d3158bf07.
Change-Id: I8d34329b8a2771eb4068ab50414c9eac6fd73d3f
Reviewed-on: https://chromium-review.googlesource.com/215612
Reviewed-by: Prashanth B <beeps@chromium.org>
Commit-Queue: Prashanth B <beeps@chromium.org>
Tested-by: Prashanth B <beeps@chromium.org>
diff --git a/scheduler/monitor_db.py b/scheduler/monitor_db.py
index ea57bcf..e785c04 100755
--- a/scheduler/monitor_db.py
+++ b/scheduler/monitor_db.py
@@ -276,8 +276,6 @@
self._periodic_cleanup.initialize()
self._24hr_upkeep.initialize()
- self._restore_tasks_where_scheduling_was_interrupted()
-
# always recover processes
self._recover_processes()
@@ -295,34 +293,6 @@
logging.debug(msg)
- def _restore_tasks_where_scheduling_was_interrupted(self):
- """
- Restore consistent database state after being interrupted.
-
- If the scheduler gets interrupted in a disadvantageous moment it might
- leave host queue entries behind that have a host assigned, but not an
- execution subdirectory. This function restores a consistent state by
- rescheduling those entries.
- """
- # See crosbug.com/334353
- SQL_SUSPECT_ENTRIES_WHERE = ('complete!=1 AND execution_subdir="" AND '
- 'status!="Queued";')
- queue_entries = scheduler_models.HostQueueEntry.fetch(
- where=SQL_SUSPECT_ENTRIES_WHERE)
-
- for queue_entry in queue_entries:
- # Aborting special tasks. Decoupling them from the HQE so the
- # HostQueueEntry doesn't get rescheduled because of the aborted
- # and therefore failing SpecialTask.
- # Aborting all special tasks will lead to their hosts getting
- # repaired before releasing them into the ready pool.
- special_tasks = models.SpecialTask.objects.filter(
- host__id=queue_entry.host_id,
- is_active=True,
- is_complete=False).update(is_aborted=True, queue_entry=None)
- queue_entry.requeue()
-
-
def tick(self):
"""
This is an altered version of tick() where we keep track of when each
@@ -898,6 +868,7 @@
# always needs a host, but doesn't always need a hqe.
for agent in self._host_agents.get(task.host.id, []):
if isinstance(agent.task, agent_task.SpecialAgentTask):
+
# The epilog preforms critical actions such as
# queueing the next SpecialTask, requeuing the
# hqe etc, however it doesn't actually kill the
@@ -908,8 +879,8 @@
# _handle_agents to schedule any more special
# tasks against the host, and it must be set
# in addition to is_active, is_complete and success.
- agent.abort()
agent.task.epilog()
+ agent.task.abort()
def _can_start_agent(self, agent, num_started_this_cycle,