def get_benchmark_execution_relevant(request, bench_exec_id): """ Returns a benchmark execution """ data = {} data['menu'] = ViewPrepareObjects.prepare_menu_for_html([]) exec_entry = BenchmarkExecutionEntry.objects.filter( id=bench_exec_id).first() if exec_entry is None: return res.get_template_data(request, 'presenter/not_found.html', data) obj = exec_entry.as_object() data[ 'results'] = ViewPrepareObjects.prepare_results_from_bench_exec_to_html( obj) data['url'] = {} data['url'][ 'invalidate'] = ViewUrlGenerator.get_benchmark_execution_invalidate_url( exec_entry.id) data['url'][ 'complete'] = ViewUrlGenerator.get_benchmark_execution_complete_url( exec_entry.id) return res.get_template_data( request, 'presenter/benchmark_execution_relevant.html', data)
def get_workers_with_benchmark_info(worker_entries): """ Returns a list of workers with additional urls associated with those workers """ workers = [] for entry in worker_entries: wrk = entry.as_object() wrk['latest_benchmarks'] = [] bench_execs = BenchmarkExecutionEntry.objects.filter( worker__id=entry.id, status__in=[ BenchmarkExecutionEntry.FINISHED, BenchmarkExecutionEntry.FINISHED_WITH_ERRORS ], ).order_by('-updated_at')[:MAX_LATEST_BENCHMARKS] for bench in bench_execs: bench_info = {} bench_info['id'] = bench.id bench_info[ 'url'] = ViewUrlGenerator.get_benchmark_execution_complete_url( bench.id) wrk['latest_benchmarks'].append(bench_info) workers.append(wrk) return workers