blob: 2022f64ead691ff559e4302e92d0eb417b07ad9e [file] [log] [blame]
Simran Basiaf9b8e72012-10-12 15:02:36 -07001# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5class _SiteAbstractDrone(object):
6 """
7 This is a site subclass of _BaseAbstractDrone in drones.py. Any methods
8 here automatically overload _BaseAbstractDrone and are used to create
9 _AbstractDrone for consumers.
10 """
11
12
13 def __init__(self):
14 """
15 Add a new private variable _processes_to_kill to _AbstractDrone
16 """
17 super(_SiteAbstractDrone, self).__init__()
18 self._processes_to_kill = []
19
20
21 def queue_kill_process(self, process):
22 """Queue a process to kill/abort.
23
24 @param process: Process to kill/abort.
25 """
26 self._processes_to_kill.append(process)
27
28
29 def clear_processes_to_kill(self):
30 """Reset the list of processes to kill for this tick."""
31 self._processes_to_kill = []
32
33
34 def execute_queued_calls(self):
35 """Overloads execute_queued_calls().
36
37 If there are any processes queued to kill, kill them then process the
38 remaining queued up calls.
39 """
40 if self._processes_to_kill:
41 self.queue_call('kill_processes', self._processes_to_kill)
42 self.clear_processes_to_kill()
Prashanth B340fd1e2014-06-22 12:44:10 -070043 return super(_SiteAbstractDrone, self).execute_queued_calls()