def get_benchmark_execution_window(request, bench_exec_id): """ Returns a window of benchmark executions centered on bench_exe_id """ if request.method != 'GET': return res.get_template_data(request, 'presenter/not_found.html', {}) bench_exec = BenchmarkExecutionEntry.objects.filter( id=bench_exec_id).first() if not bench_exec: return res.get_template_data(request, 'presenter/not_found.html', {}) commit_info = bench_exec.commit.as_object() exec_stacked = BenchmarkExecutionController.get_benchmark_execution_window( bench_exec, BENCH_EXEC_WINDOW_HALF) executions = ViewPrepareObjects.prepare_stacked_executions_url_field( request.get_host(), exec_stacked) executions = ViewPrepareObjects.prepare_windowed_executions_colors( executions, commit_info['hash']) executions = ViewPrepareObjects.prepare_stacked_executions_json_field( executions) data = {} data['commit_info'] = commit_info data['stacked_executions'] = executions data['menu'] = ViewPrepareObjects.prepare_menu_for_html([]) return res.get_template_data(request, 'presenter/benchmark_execution_stacked.html', data)
def get_benchmark_executions_stacked(request, project_id, branch_id, definition_id, worker_id, page_index): """ Returns benchmark executions stacked and paginated """ if request.method != 'GET': return res.get_template_data(request, 'presenter/not_found.html', {}) project = BluesteelProjectEntry.objects.filter(id=project_id).first() if project is None: return res.get_template_data(request, 'presenter/not_found.html', {}) git_project = GitProjectEntry.objects.filter( id=project.git_project.id).first() if git_project is None: return res.get_template_data(request, 'presenter/not_found.html', {}) branch = GitBranchEntry.objects.filter(id=branch_id, project=git_project).first() if branch is None: return res.get_template_data(request, 'presenter/not_found.html', {}) definition = BenchmarkDefinitionEntry.objects.filter( id=definition_id, project=project).first() if definition is None: return res.get_template_data(request, 'presenter/not_found.html', {}) worker = WorkerEntry.objects.filter(id=worker_id).first() if worker is None: return res.get_template_data(request, 'presenter/not_found.html', {}) page = Page(BENCH_EXEC_ITEMS_PER_PAGE, page_index) commit_hashes, pagination = BenchmarkExecutionController.get_bench_exec_commits_paginated( git_project, branch, page) pagination = ViewPrepareObjects.prepare_pagination_bench_stacked( project_id, branch_id, definition_id, worker_id, pagination) data_exec = BenchmarkExecutionController.get_stacked_executions_from_branch( git_project, branch, commit_hashes, definition, worker) exec_stacked = BenchmarkExecutionController.get_stacked_data_separated_by_id( data_exec) executions = ViewPrepareObjects.prepare_stacked_executions_url_field( request.get_host(), exec_stacked) executions = ViewPrepareObjects.prepare_stacked_executions_json_field( executions) data = {} data['stacked_executions'] = executions data['pagination'] = pagination data['menu'] = ViewPrepareObjects.prepare_menu_for_html([]) return res.get_template_data(request, 'presenter/benchmark_execution_stacked.html', data)
def get_benchmark_executions_stacked_quick(request, project_id, branch_id, definition_id, worker_id): """ Returns benchmark executions stacked and paginated """ if request.method == 'GET': project = BluesteelProjectEntry.objects.filter(id=project_id).first() if project is None: return res.get_response(404, 'BluesteelProject not found', {}) git_project = GitProjectEntry.objects.filter( id=project.git_project.id).first() if git_project is None: return res.get_response(404, 'GitProject not found', {}) branch = GitBranchEntry.objects.filter(id=branch_id, project=git_project).first() if branch is None: return res.get_response(404, 'GitBranchEntry not found', {}) definition = BenchmarkDefinitionEntry.objects.filter( id=definition_id, project=project).first() if definition is None: return res.get_response(404, 'BenchmarkDefinitionEntry not found', {}) worker = WorkerEntry.objects.filter(id=worker_id).first() if worker is None: return res.get_response(404, 'WorkerEntry not found', {}) page = Page(BENCH_QUICK_ITEMS, BENCH_QUICK_DEFAULT_PAGE) commit_hashes_list, pagination = BenchmarkExecutionController.get_bench_exec_commits_paginated( git_project, branch, page) del pagination data_exec = BenchmarkExecutionController.get_stacked_executions_from_branch( git_project, branch, commit_hashes_list, definition, worker) exec_stacked = BenchmarkExecutionController.get_stacked_data_separated_by_id( data_exec) execs = ViewPrepareObjects.prepare_stacked_executions_url_field( request.get_host(), exec_stacked) execs = ViewPrepareObjects.prepare_stacked_executions_json_field(execs) data = {} data['stacked_executions'] = execs return res.get_response(200, 'Benchmark Execution Stacked', data) else: return res.get_only_get_allowed({})