def get_context_data(self, **kwargs): context = super(self.__class__, self).get_context_data(**kwargs) ids = [it["max_id"] for it in TaskPeriodList.last_runs(history=1)] tasks = Task.objects.filter(recipe__job__schedule__id__in=ids)\ .values("result", "recipe__job__schedule__title")\ .annotate(dcount=Count("result"), scount=Count("recipe__job__schedule"))\ .order_by("result") context["grouptest"] = GroupTestTemplate.objects.values( "group__name").annotate(dcount=Count("group")).order_by("-dcount") context["repotest"] = Test.objects.values("git__name").annotate( dcount=Count("git")).order_by("-dcount") context["testlengths"] = \ Task.objects.filter(recipe__job__schedule__date_create__gte=timezone.now() + timedelta(hours=-settings .LONGEST_RUNNING_PERIOD))\ .values("test__name","test__id").annotate(avg_duration=Avg('duration'))\ .annotate(runs=Count('test_id'))\ .order_by("-avg_duration")[0:2*settings.LONGEST_RUNNING_COLUMN_LENGTH+1] running_ids = ListId.running(ids) repotask = Test.objects.filter( id__in=running_ids).values("git__name").annotate( dcount=Count("git")).order_by("-dcount") keys = dict([(it["git__name"], it["dcount"]) for it in repotask]) for it in context["repotest"]: if it["git__name"] in keys: it.update({"run": keys[it["git__name"]]}) it.update({"notrun": it["dcount"] - keys[it["git__name"]]}) t = {} for it in tasks: key = it["recipe__job__schedule__title"] if key not in t: t[key] = {} t[key].update({it["result"]: it["dcount"]}) context["tasks"] = t if self.repo: context["nonrun"] = Test.objects.filter( is_enable=True, git__name=self.repo).exclude(id__in=running_ids) report = ReportList(ids) # get statistic about last runs report.stat_tasks() report.stat_recipes() context["reports"] = report context["external_links"] = ExternalPage.objects.filter( is_enabled=True) return context
def get_context_data(self, **kwargs): context = super(self.__class__, self).get_context_data(**kwargs) ids = [it["max_id"] for it in TaskPeriodList.last_runs(history=1)] tasks = Task.objects.filter(recipe__job__schedule__id__in=ids)\ .values("result", "recipe__job__schedule__title")\ .annotate(dcount=Count("result"), scount=Count("recipe__job__schedule"))\ .order_by("result") context["grouptest"] = GroupTestTemplate.objects.values( "group__name").annotate(dcount=Count("group")).order_by("-dcount") context["repotest"] = Test.objects.values("git__name").annotate( dcount=Count("git")).order_by("-dcount") context["testlengths"] = \ Task.objects.filter(recipe__job__schedule__date_create__gte=datetime.now() + timedelta(hours=-settings .LONGEST_RUNNING_PERIOD))\ .values("test__name","test__id").annotate(avg_duration=Avg('duration'))\ .annotate(runs=Count('test_id'))\ .order_by("-avg_duration")[0:2*settings.LONGEST_RUNNING_COLUMN_LENGTH+1] running_ids = ListId.running(ids) repotask = Test.objects.filter(id__in=running_ids).values( "git__name").annotate(dcount=Count("git")).order_by("-dcount") keys = dict([(it["git__name"], it["dcount"]) for it in repotask]) for it in context["repotest"]: if it["git__name"] in keys: it.update({"run": keys[it["git__name"]]}) it.update({"notrun": it["dcount"] - keys[it["git__name"]]}) t = {} for it in tasks: key = it["recipe__job__schedule__title"] if key not in t: t[key] = {} t[key].update({it["result"]: it["dcount"]}) context["tasks"] = t if self.repo: context["nonrun"] = Test.objects.filter( is_enable=True, git__name=self.repo).exclude(id__in=running_ids) report = ReportList(ids) # get statistic about last runs report.stat_tasks() report.stat_recipes() context["reports"] = report context["external_links"] = ExternalPage.objects.filter( is_enabled=True) return context
def get_context_data(self, **kwargs): context = super(self.__class__, self).get_context_data(**kwargs) ids = [it["max_id"] for it in TaskPeriodList.last_runs(history=1)] tasks = Task.objects.filter(recipe__job__schedule__id__in=ids)\ .values("result", "recipe__job__schedule__title")\ .annotate(dcount=Count("result"), scount=Count("recipe__job__schedule"))\ .order_by("result") context["grouptest"] = GroupTestTemplate.objects.values( "group__name").annotate(dcount=Count("group")).order_by("-dcount") context["repotest"] = Test.objects.values("git__name").annotate( dcount=Count("git")).order_by("-dcount") running_ids = ListId.running(ids) repotask = Test.objects.filter( id__in=running_ids).values("git__name").annotate( dcount=Count("git")).order_by("-dcount") keys = dict([(it["git__name"], it["dcount"]) for it in repotask]) for it in context["repotest"]: if it["git__name"] in keys: it.update({"run": keys[it["git__name"]]}) it.update({"notrun": it["dcount"] - keys[it["git__name"]]}) t = {} for it in tasks: key = it["recipe__job__schedule__title"] if key not in t: t[key] = {} t[key].update({it["result"]: it["dcount"]}) context["tasks"] = t if self.repo: context["nonrun"] = Test.objects.filter( is_enable=True, git__name=self.repo).exclude(id__in=running_ids) report = ReportList(ids) # get statistic about last runs report.stat_tasks() report.stat_recipes() context["reports"] = report context["external_links"] = ExternalPage.objects.filter( is_enabled=True) return context
def get_context_data(self, **kwargs): context = super(self.__class__, self).get_context_data(**kwargs) ids = [it["max_id"] for it in TaskPeriodList.last_runs()] tasks = Task.objects.filter(recipe__job__schedule__id__in=ids)\ .values("result", "recipe__job__schedule__title")\ .annotate(dcount=Count("result"), scount=Count("recipe__job__schedule"))\ .order_by("result") context["grouptest"] = GroupTestTemplate.objects.values( "group__name").annotate(dcount=Count("group")).order_by("-dcount") context["repotest"] = Test.objects.values("git__name").annotate( dcount=Count("git")).order_by("-dcount") running_ids = ListId.running(ids) repotask = Test.objects.filter(id__in=running_ids).values( "git__name").annotate(dcount=Count("git")).order_by("-dcount") keys = dict([(it["git__name"], it["dcount"]) for it in repotask]) for it in context["repotest"]: if it["git__name"] in keys: it.update({"run": keys[it["git__name"]]}) it.update({"notrun": it["dcount"] - keys[it["git__name"]]}) t = {} for it in tasks: key = it["recipe__job__schedule__title"] if key not in t: t[key] = {} t[key].update({it["result"]: it["dcount"]}) context["tasks"] = t if self.repo: context["nonrun"] = Test.objects.filter( is_enable=True, git__name=self.repo).exclude(id__in=running_ids) #context["reports"] = Report.objects.filter(is_enabled=True) report = ReportList(ids) # get statistic about tests report.stat_tests() # get statistic about last runs report.stat_tasks() report.stat_recipes() context["reports"] = report return context
def get_context_data(self, **kwargs): context = super(self.__class__, self).get_context_data(**kwargs) form = HomepageForm(self.request.GET) form.is_valid() context["forms"] = form self.filters = form.cleaned_data try: context['progress'] = CheckProgress.objects.order_by( "-datestart")[0] except IndexError: context['progress'] = None # Waiver comments = Comment.objects\ .filter(created_date__gt=datetime.today().date())\ .order_by("-created_date", "task", "recipe", "job") paginator = Paginator(comments, settings.PAGINATOR_OBJECTS_ONHOMEPAGE) context['waiver'] = paginator.page( int(self.request.GET.get('cpage', 1))) context['cpaginator'] = paginator history = TestHistory.objects.filter().order_by( "-date")[:settings.PAGINATOR_OBJECTS_ONHOMEPAGE * 10] paginator = Paginator(history, settings.PAGINATOR_OBJECTS_ONHOMEPAGE) context['history'] = paginator.page( int(self.request.GET.get('hpage', 1))) context['hpaginator'] = paginator # context['networking'] = self.get_network_stas() ids = [it["max_id"] for it in TaskPeriodList.last_runs()] filter_ids = ids if self.filters.get("schedule"): filter_ids = [int(self.filters.get("schedule"))] order = self.filters.get("order") if self.filters.get("order") else "score" context["score"] = Score.objects.filter( schedule__in=filter_ids).order_by(order)[:10] context["schedules"] = TaskPeriodSchedule.objects.filter(id__in=ids).order_by("period") return context
def get_context_data(self, **kwargs): context = super(self.__class__, self).get_context_data(**kwargs) form = HomepageForm(self.request.GET) form.is_valid() context["forms"] = form self.filters = form.cleaned_data pag_type = self.request.GET.get('type') if settings.ELASTICSEARCH: self.es = Elasticsearch(settings.ELASTICSEARCH) if self.es.ping(): context["elasticsearch"] = self.es.info() context['search'] = self.search() try: context['progress'] = CheckProgress.objects.order_by( "-datestart")[0] except IndexError: context['progress'] = None # Waiver comments = Comment.objects\ .filter(created_date__gt=timezone.now().date())\ .order_by("-created_date", "task", "recipe", "job") paginator = Paginator(comments, settings.PAGINATOR_OBJECTS_ONHOMEPAGE) context['waiver'] = paginator.page( int(self.request.GET.get('cpage', 1))) history = TestHistory.objects.filter().order_by( "-date")[:settings.PAGINATOR_OBJECTS_ONHOMEPAGE * 10] paginator = Paginator(history, settings.PAGINATOR_OBJECTS_ONHOMEPAGE) context['history'] = paginator.page( int(self.request.GET.get('hpage', 1))) # context['networking'] = self.get_network_stas() ids = [it["max_id"] for it in TaskPeriodList.last_runs()] filter_ids = ids if self.filters.get("schedule"): filter_ids = [int(self.filters.get("schedule"))] order = self.filters.get("order") if self.filters.get( "order") else "score" # Score score_obj = Score.objects.filter( schedule__in=filter_ids).order_by(order) score = Paginator(score_obj, settings.PAGINATOR_OBJECTS_ONHOMEPAGE) page = 1 if "score" == pag_type: page = int(self.filters.get('page', 1)) context["score"] = score.page(int(page)) range_min = page - 5 range_range = 10 if page <= range_range / 2: range_min = 1 range_range += page if score.page_range[-1] < range_min + range_range: range_min = score.page_range[-1] - range_range context["score"].ranges = sorted( set([1, page, score.page_range[-1] ]).union(range(range_min, range_min + range_range))) context["schedules"] = TaskPeriodSchedule.objects.filter( id__in=ids).order_by("period") context["files"] = { "indexed": FileLog.objects.filter(is_indexed=False, is_downloaded=True).count(), "downloaded": FileLog.objects.filter(status_code=0).count() } self.call_broken_systems() context["brokensystems"] = self.brokensystems return context
def get_context_data(self, **kwargs): context = super(self.__class__, self).get_context_data(**kwargs) form = HomepageForm(self.request.GET) form.is_valid() context["forms"] = form self.filters = form.cleaned_data pag_type = self.request.GET.get('type') if settings.ELASTICSEARCH: context['search'] = self.search() try: context['progress'] = CheckProgress.objects.order_by( "-datestart")[0] except IndexError: context['progress'] = None # Waiver comments = Comment.objects\ .filter(created_date__gt=datetime.today().date())\ .order_by("-created_date", "task", "recipe", "job") paginator = Paginator(comments, settings.PAGINATOR_OBJECTS_ONHOMEPAGE) context['waiver'] = paginator.page( int(self.request.GET.get('cpage', 1))) history = TestHistory.objects.filter().order_by( "-date")[:settings.PAGINATOR_OBJECTS_ONHOMEPAGE * 10] paginator = Paginator(history, settings.PAGINATOR_OBJECTS_ONHOMEPAGE) context['history'] = paginator.page( int(self.request.GET.get('hpage', 1))) # context['networking'] = self.get_network_stas() ids = [it["max_id"] for it in TaskPeriodList.last_runs()] filter_ids = ids if self.filters.get("schedule"): filter_ids = [int(self.filters.get("schedule"))] order = self.filters.get( "order") if self.filters.get("order") else "score" # Score score_obj = Score.objects.filter( schedule__in=filter_ids).order_by(order) score = Paginator(score_obj, settings.PAGINATOR_OBJECTS_ONHOMEPAGE) page = 1 if "score" == pag_type: page = int(self.filters.get('page', 1)) context["score"] = score.page(int(page)) range_min = page - 5 range_range = 10 if page <= range_range / 2: range_min = 1 range_range += page if score.page_range[-1] < range_min + range_range: range_min = score.page_range[-1] - range_range context["score"].ranges = sorted(set( [1, page, score.page_range[-1]]).union(range(range_min, range_min + range_range))) context["schedules"] = TaskPeriodSchedule.objects.filter( id__in=ids).order_by("period") context["files"] = { "indexed": FileLog.objects.filter(is_indexed=False, is_downloaded=True).count(), "downloaded": FileLog.objects.filter(status_code=0).count() } return context