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

Side by Side Diff: scheduler/drone_manager.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 10 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
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 drone = self._add_drone(hostname) 162 self._add_drone(hostname)
163 drone.call('initialize', self.absolute_path(''))
164 163
165 if not self._drones: 164 if not self._drones:
166 # all drones failed to initialize 165 # all drones failed to initialize
167 raise DroneManagerError('No valid drones found') 166 raise DroneManagerError('No valid drones found')
168 167
169 self.refresh_drone_configs() 168 self.refresh_drone_configs()
170 169
171 logging.info('Using results repository on %s', 170 logging.info('Using results repository on %s',
172 results_repository_hostname) 171 results_repository_hostname)
173 self._results_drone = drones.get_drone(results_repository_hostname) 172 self._results_drone = drones.get_drone(results_repository_hostname)
(...skipping 24 matching lines...) Expand all
198 """ 197 """
199 pidfile_timeout = global_config.global_config.get_config_value( 198 pidfile_timeout = global_config.global_config.get_config_value(
200 scheduler_config.CONFIG_SECTION, 'max_pidfile_refreshes', 199 scheduler_config.CONFIG_SECTION, 'max_pidfile_refreshes',
201 type=int, default=2000) 200 type=int, default=2000)
202 return pidfile_timeout 201 return pidfile_timeout
203 202
204 203
205 def _add_drone(self, hostname): 204 def _add_drone(self, hostname):
206 logging.info('Adding drone %s' % hostname) 205 logging.info('Adding drone %s' % hostname)
207 drone = drones.get_drone(hostname) 206 drone = drones.get_drone(hostname)
208 self._drones[drone.hostname] = drone 207 if drone:
209 return drone 208 self._drones[drone.hostname] = 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
« cli/job.py ('K') | « global_config.ini ('k') | scheduler/drones.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698