blob: febe2b708513a37cd64b00f5d61cb39a1ba7649a [file] [log] [blame]
Simran Basicced3092012-08-02 15:09:23 -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.
4import logging
5
6from autotest_lib.client.common_lib import global_config
7from autotest_lib.scheduler import scheduler_config
8
9HOSTS_JOB_SUBDIR = 'hosts/'
Simran Basi8f858d02012-08-03 15:28:55 -070010PARSE_LOG = '.parse.log'
Simran Basicced3092012-08-02 15:09:23 -070011
12
13class SiteDroneManager(object):
14
15
16 def copy_to_results_repository(self, process, source_path,
17 destination_path=None):
18 """
19 Copy results from the given process at source_path to destination_path
20 in the results repository.
21
22 This site subclassed version will only copy the results back for Special
23 Agent Tasks (Cleanup, Verify, Repair) that reside in the hosts/
24 subdirectory of results if the copy_task_results_back flag has been set
25 to True inside global_config.ini
Simran Basi8f858d02012-08-03 15:28:55 -070026
27 It will also only copy .parse.log files back to the scheduler if the
28 copy_parse_log_back flag in global_config.ini has been set to True.
Simran Basicced3092012-08-02 15:09:23 -070029 """
30 copy_task_results_back = global_config.global_config.get_config_value(
31 scheduler_config.CONFIG_SECTION, 'copy_task_results_back',
32 type=bool)
Simran Basi8f858d02012-08-03 15:28:55 -070033 copy_parse_log_back = global_config.global_config.get_config_value(
34 scheduler_config.CONFIG_SECTION, 'copy_parse_log_back',
35 type=bool)
Simran Basicced3092012-08-02 15:09:23 -070036 special_task = source_path.startswith(HOSTS_JOB_SUBDIR)
Simran Basi8f858d02012-08-03 15:28:55 -070037 parse_log = source_path.endswith(PARSE_LOG)
38 if (copy_task_results_back or not special_task) and (
39 copy_parse_log_back or not parse_log):
Simran Basicced3092012-08-02 15:09:23 -070040 super(SiteDroneManager, self).copy_to_results_repository(process,
Simran Basi8f858d02012-08-03 15:28:55 -070041 source_path, destination_path)