Mike Truty | a2e1853 | 2011-04-06 15:11:22 -0700 | [diff] [blame] | 1 | # Copyright (c) 2011 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. |
Simran Basi | af9b8e7 | 2012-10-12 15:02:36 -0700 | [diff] [blame] | 4 | import logging, signal |
Mike Truty | a2e1853 | 2011-04-06 15:11:22 -0700 | [diff] [blame] | 5 | |
Simran Basi | af9b8e7 | 2012-10-12 15:02:36 -0700 | [diff] [blame] | 6 | from autotest_lib.client.common_lib import error, utils |
Mike Truty | a2e1853 | 2011-04-06 15:11:22 -0700 | [diff] [blame] | 7 | |
| 8 | # Override default parser with our site parser. |
| 9 | # This is coordinated with site_monitor_db.py. |
| 10 | def check_parse(process_info): |
| 11 | return process_info['comm'] == 'site_parse' |
Simran Basi | af9b8e7 | 2012-10-12 15:02:36 -0700 | [diff] [blame] | 12 | |
| 13 | |
| 14 | class SiteDroneUtility(object): |
| 15 | |
| 16 | |
| 17 | def kill_processes(self, process_list): |
| 18 | signal_queue = (signal.SIGCONT, signal.SIGTERM, signal.SIGKILL) |
| 19 | try: |
| 20 | logging.info('List of process to be killed: %s', process_list) |
| 21 | utils.nuke_pids([process.pid for process in process_list], |
| 22 | signal_queue=signal_queue) |
| 23 | except error.AutoservRunError as e: |
| 24 | self._warn('Error occured when killing processes. Error: %s' % e) |