def _process_results_to_be_stored( self, sli: Dict[str, Any], datetime: datetime.datetime, timestamp: datetime.datetime, ) -> Dict[str, Any]: """Create inputs for SLI dataframe to be stored. @param sli: It's a dict of SLI associated with the SLI type. """ parameters = locals() parameters.pop("self") output = self._create_default_inputs_for_df_sli(**parameters) html_inputs = self._evaluate_sli(sli=sli) output["new_packages"] = np.nan output["new_packages_releases"] = np.nan if not self.configuration.dry_run: html_inputs = process_html_inputs( html_inputs=html_inputs, sli_name=self._SLI_NAME, last_period_time=self.configuration.last_week_time, ceph_sli=self.configuration.ceph_sli, sli_columns=self.sli_columns, store_columns=self.store_columns, is_storing=True, ) output["new_packages"] = html_inputs["total_packages"]["change"] # type: ignore output["new_packages_releases"] = html_inputs["total_releases"]["change"] # type: ignore return output
def _report_sli(self, sli: Dict[str, Any]) -> str: """Create report for knowledge graph SLI. @param sli: It's a dict of SLI associated with the SLI type. """ html_inputs = self._evaluate_sli(sli=sli) if not self.configuration.dry_run: report = HTMLTemplates.thoth_knowledge_template( html_inputs=process_html_inputs( html_inputs=html_inputs, sli_name=self._SLI_NAME, last_period_time=self.configuration.last_week_time, ceph_sli=self.configuration.ceph_sli, sli_columns=self.sli_columns, store_columns=self.store_columns, ), ) else: report = HTMLTemplates.thoth_knowledge_template(html_inputs=html_inputs) return report