def run(self): results_uri = build_absolute_uri(reverse('testresult-list')) raw_result_uri = build_absolute_uri(reverse('testrawresult-list')) task_uri = build_absolute_uri(reverse('task-detail', args=[ self.id, ])) test_run_uri = build_absolute_uri( reverse('testrun-detail', args=[ self.test_run_id, ])) test_run = self.test_run suite = SimpleTestSuite() result = suite.run(task_id=self.id, retries=test_run.retries, url=test_run.test_run_uri, app_commit=test_run.app_commit, config_commit=test_run.config_commit, results_uri=results_uri, raw_result_uri=raw_result_uri, task_uri=task_uri, test_run_uri=test_run_uri) self.job_id = result.id self.status = TaskStatus.from_celery_status(result.status) self.save()
def get_profile_image(self, obj): if obj.profile_image: return build_absolute_uri(obj.profile_image.url) return ''
def handle(self, *args, **options): params = { 'url': 'http://www.wikia.com/Wikia?noexternals=1', 'retries': options['runs'], } pg = PhantomasGet() pg_metrics = pg.run(**params) mg = MWProfilerGet() mg_metrics = mg.run(**params) hg = HttpGet() hg_metrics = hg.run(**params) sg = SeleniumGet() sg_metrics = sg.run(**params) if options['seleniumout']: with open(options['seleniumout'], 'w') as f: ujson.dump(sg_metrics, f) data = [pg_metrics, mg_metrics, hg_metrics, sg_metrics] # print data rg = ProcessResponses() rr = rg.run( data, result_uri=build_absolute_uri(reverse('testresult-list')), task_uri=build_absolute_uri(reverse('task-detail', args=[ 1, ])), test_run_uri=build_absolute_uri( reverse('testrun-detail', args=[ 1, ])), ) if options['out']: with open(options['out'], 'w') as f: ujson.dump(rr, f)
def run(self): result_uri=build_absolute_uri(reverse('testresult-list')) task_uri=build_absolute_uri(reverse('task-detail', args=[self.id, ])) test_run_uri=build_absolute_uri(reverse('testrun-detail', args=[self.test_run_id, ])) test_run = self.test_run suite = SimpleTestSuite() result = suite.run( task_id=self.id, retries=test_run.retries, url=test_run.test_run_uri, app_commit=test_run.app_commit, config_commit=test_run.config_commit, result_uri=result_uri, task_uri=task_uri, test_run_uri=test_run_uri ) self.job_id = result.id self.status = TaskStatus.from_celery_status(result.status) self.save()
def on_task_manager_request_status_update(sender, task_id, job_id, status, **kwargs): logger.debug('on_task_manager_request_status_update {} {}'.format(job_id, status)) from tasks.models import TaskStatus sparrow_status = TaskStatus.from_celery_status(status) logger.debug('Task #{} received status update from celery ({}): status = {}'.format( task_id, job_id, TaskStatus.label(sparrow_status))) task_url = build_absolute_uri('/api/v1/tasks/{}/'.format(task_id)) response = requests.patch(task_url, json={ 'status': sparrow_status }) response.raise_for_status()
def handle(self, *args, **options): params = { 'url': 'http://www.wikia.com/Wikia?noexternals=1', 'retries': options['runs'], } pg = PhantomasGet() pg_metrics = pg.run(**params) mg = MWProfilerGet() mg_metrics = mg.run(**params) hg = HttpGet() hg_metrics = hg.run(**params) sg = SeleniumGet() sg_metrics = sg.run(**params) if options['seleniumout']: with open(options['seleniumout'], 'w') as f: ujson.dump(sg_metrics,f) data = [pg_metrics, mg_metrics, hg_metrics, sg_metrics] # print data rg = ProcessResponses() rr = rg.run(data, result_uri=build_absolute_uri(reverse('testresult-list')), task_uri=build_absolute_uri(reverse('task-detail', args=[1, ])), test_run_uri=build_absolute_uri(reverse('testrun-detail', args=[1, ])), ) if options['out']: with open(options['out'],'w') as f: ujson.dump(rr,f)
def handle(self, *args, **options): if options['datafile']: with open(options['datafile'], 'r') as f: data = ujson.load(f) elif options['resultid']: url = build_absolute_uri('/api/v1/results/{}/'.format(options['resultid'])) response = requests.get(url) data = response.json()['results'] else: raise RuntimeError('You need to specify either --resultid or --datafile') all_metrics = Collection.unserialize(data) basic_metric_set = BasicMetricSet(all_metrics) basic_metrics = basic_metric_set.items for k, v in basic_metrics.items(): print('METRIC: {}'.format(k)) dump_stats(v)