[autotest] Teach the scheduler to abort SpecialTasks.

1. Database migration that adds a column to afe_special_tasks.
2. An rpc that modifies the db with the abort bit.
3. A scheduler method that polls the database for aborted jobs
   and handles the agent.

TEST=Scheduled a job and aborted it's special tasks. Checked that
     subsequent special tasks were scheduled.
     Aborted Repair->host goes into repair fail.
     Aborted (Reset, Verify, Cleanup)->Repair queued.
     Checked that the Hqe is requeued through PreJobTask epilog.
     Aborted SpecialTasks without hqes.
     Aborted jobs normally through the frontend.

BUG=chromium:234223
DEPLOY=migrate, apache, scheduler

Change-Id: I1a47bc2d801486a8abdffb44091c59a8f5bdbefc
Reviewed-on: https://gerrit.chromium.org/gerrit/64753
Commit-Queue: Prashanth Balasubramanian <beeps@chromium.org>
Reviewed-by: Prashanth Balasubramanian <beeps@chromium.org>
Tested-by: Prashanth Balasubramanian <beeps@chromium.org>
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 1789ab2..fe141be 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -42,7 +42,7 @@
     """Get the parameterized autoupdate image url from a parameterized job."""
     known_test_obj = models.Test.smart_get('autoupdate_ParameterizedJob')
     image_parameter = known_test_obj.testparameter_set.get(test=known_test_obj,
-                                                           name='image')        
+                                                           name='image')
     para_set = job.parameterized_job.parameterizedjobparameter_set
     job_test_para = para_set.get(test_parameter=image_parameter)
     return job_test_para.parameter_value
@@ -594,6 +594,16 @@
     models.HostQueueEntry.abort_host_queue_entries(host_queue_entries)
 
 
+def abort_special_tasks(**filter_data):
+    """\
+    Abort the special task, or tasks, specified in the filter.
+    """
+    query = models.SpecialTask.query_objects(filter_data)
+    special_tasks = query.filter(is_active=True)
+    for task in special_tasks:
+        task.abort()
+
+
 def _call_special_tasks_on_hosts(task, hosts):
     """\
     Schedules a set of hosts for a special task.