Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: scheduler/drone_manager.py

Issue 6124004: Revert "Merge remote branch 'cros/upstream' into autotest-rebase" (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frontend/tko/rpc_interface_unittest.py ('k') | scheduler/drones.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os, re, shutil, signal, subprocess, errno, time, heapq, traceback 1 import os, re, shutil, signal, subprocess, errno, time, heapq, traceback
2 import common, logging 2 import common, logging
3 from autotest_lib.client.common_lib import error, global_config 3 from autotest_lib.client.common_lib import error, global_config
4 from autotest_lib.scheduler import email_manager, drone_utility, drones 4 from autotest_lib.scheduler import email_manager, drone_utility, drones
5 from autotest_lib.scheduler import scheduler_config 5 from autotest_lib.scheduler import scheduler_config
6 6
7 7
8 # results on drones will be placed under the drone_installation_directory in a 8 # results on drones will be placed under the drone_installation_directory in a
9 # directory with this name 9 # directory with this name
10 _DRONE_RESULTS_DIR_SUFFIX = 'results' 10 _DRONE_RESULTS_DIR_SUFFIX = 'results'
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 self._attached_files = {} 152 self._attached_files = {}
153 # heapq of _DroneHeapWrappers 153 # heapq of _DroneHeapWrappers
154 self._drone_queue = [] 154 self._drone_queue = []
155 155
156 156
157 def initialize(self, base_results_dir, drone_hostnames, 157 def initialize(self, base_results_dir, drone_hostnames,
158 results_repository_hostname): 158 results_repository_hostname):
159 self._results_dir = base_results_dir 159 self._results_dir = base_results_dir
160 160
161 for hostname in drone_hostnames: 161 for hostname in drone_hostnames:
162 self._add_drone(hostname) 162 drone = self._add_drone(hostname)
163 drone.call('initialize', self.absolute_path(''))
163 164
164 if not self._drones: 165 if not self._drones:
165 # all drones failed to initialize 166 # all drones failed to initialize
166 raise DroneManagerError('No valid drones found') 167 raise DroneManagerError('No valid drones found')
167 168
168 self.refresh_drone_configs() 169 self.refresh_drone_configs()
169 170
170 logging.info('Using results repository on %s', 171 logging.info('Using results repository on %s',
171 results_repository_hostname) 172 results_repository_hostname)
172 self._results_drone = drones.get_drone(results_repository_hostname) 173 self._results_drone = drones.get_drone(results_repository_hostname)
(...skipping 24 matching lines...) Expand all
197 """ 198 """
198 pidfile_timeout = global_config.global_config.get_config_value( 199 pidfile_timeout = global_config.global_config.get_config_value(
199 scheduler_config.CONFIG_SECTION, 'max_pidfile_refreshes', 200 scheduler_config.CONFIG_SECTION, 'max_pidfile_refreshes',
200 type=int, default=2000) 201 type=int, default=2000)
201 return pidfile_timeout 202 return pidfile_timeout
202 203
203 204
204 def _add_drone(self, hostname): 205 def _add_drone(self, hostname):
205 logging.info('Adding drone %s' % hostname) 206 logging.info('Adding drone %s' % hostname)
206 drone = drones.get_drone(hostname) 207 drone = drones.get_drone(hostname)
207 if drone: 208 self._drones[drone.hostname] = drone
208 self._drones[drone.hostname] = drone 209 return drone
209 drone.call('initialize', self.absolute_path(''))
210 210
211 211
212 def _remove_drone(self, hostname): 212 def _remove_drone(self, hostname):
213 self._drones.pop(hostname, None) 213 self._drones.pop(hostname, None)
214 214
215 215
216 def refresh_drone_configs(self): 216 def refresh_drone_configs(self):
217 """ 217 """
218 Reread global config options for all drones. 218 Reread global config options for all drones.
219 """ 219 """
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 700
701 def instance(): 701 def instance():
702 if _the_instance is None: 702 if _the_instance is None:
703 _set_instance(DroneManager()) 703 _set_instance(DroneManager())
704 return _the_instance 704 return _the_instance
705 705
706 706
707 def _set_instance(instance): # usable for testing 707 def _set_instance(instance): # usable for testing
708 global _the_instance 708 global _the_instance
709 _the_instance = instance 709 _the_instance = instance
OLDNEW
« no previous file with comments | « frontend/tko/rpc_interface_unittest.py ('k') | scheduler/drones.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698