def _Poll(self): if not self._task_id: self._StartTask() return logging.debug('_RunTestExecution Polling swarming: %s', self._task_id) swarming_task = swarming.Swarming(self._swarming_server).Task( self._task_id) result = swarming_task.Result() logging.debug('swarming response: %s', result) if 'bot_id' in result: # Set bot_id to pass the info back to the Quest. self._bot_id = result['bot_id'] if result['state'] == 'PENDING' or result['state'] == 'RUNNING': return if result['state'] == 'EXPIRED': raise errors.SwarmingExpired() if result['state'] != 'COMPLETED': raise errors.SwarmingTaskError(result['state']) if result['failure']: if 'outputs_ref' not in result: task_url = 'https://%s/task?id=%s' % (self._swarming_server, self._task_id) raise errors.SwarmingTaskFailed('<a href="%s">%s</a>' % (task_url, task_url)) else: isolate_output_url = 'https://%s/browse?digest=%s' % ( result['outputs_ref']['isolatedserver'], result['outputs_ref']['isolated']) raise errors.SwarmingTaskFailed( '<a href="%s">%s</a>' % (isolate_output_url, isolate_output_url)) result_arguments = { 'isolate_server': result['outputs_ref']['isolatedserver'], 'isolate_hash': result['outputs_ref']['isolated'], } self._Complete(result_arguments=result_arguments)
def _Poll(self): if not self._task_id: self._StartTask() return logging.debug('_RunTestExecution Polling swarming: %s', self._task_id) swarming_task = swarming.Swarming(self._swarming_server).Task( self._task_id) result = swarming_task.Result() logging.debug('swarming response: %s', result) if 'bot_id' in result: # Set bot_id to pass the info back to the Quest. self._bot_id = result['bot_id'] if result['state'] == 'PENDING' or result['state'] == 'RUNNING': return if result['state'] == 'EXPIRED': raise errors.SwarmingExpired() if result['state'] != 'COMPLETED': raise errors.SwarmingTaskError(result['state']) if result['failure']: exception_string = _ParseException( swarming_task.Stdout()['output']) if exception_string: raise errors.SwarmingTaskFailed(exception_string) else: raise errors.SwarmingTaskFailedNoException() result_arguments = { 'isolate_server': result['outputs_ref']['isolatedserver'], 'isolate_hash': result['outputs_ref']['isolated'], } self._Complete(result_arguments=result_arguments)