Example #1
0
def store_thoth_sli_on_ceph(
    ceph_sli: CephStore, metric_class: str, metrics_df: pd.DataFrame, ceph_path: str, is_public: bool = False,
) -> None:
    """Store Thoth SLI on Ceph."""
    metrics_csv = metrics_df.to_csv(index=False, sep="`", header=False)

    if is_public:
        _LOGGER.info(f"Storing on public bucket... {ceph_path}")

    else:
        _LOGGER.info(f"Storing on private bucket... {ceph_path}")

    ceph_sli.store_blob(blob=metrics_csv, object_key=ceph_path)
    _LOGGER.info(f"Succesfully stored Thoth weekly SLI metrics for {metric_class} at {ceph_path}")
    def store_csv_from_dataframe(
        csv_from_df: str,
        ceph_sli: CephStore,
        file_name: str,
        ceph_path: str,
        is_public: bool = False,
    ) -> None:
        """Store CSV obtained from pd.DataFrame on Ceph.

        param: csv_from_df: CSV given from pd.DataFrame.to_csv()
        """
        if is_public:
            _LOGGER.info(f"Storing on public bucket... {ceph_path}")
        else:
            _LOGGER.info(f"Storing on private bucket... {ceph_path}")
        ceph_sli.store_blob(blob=csv_from_df, object_key=ceph_path)
        _LOGGER.info(f"Succesfully stored  {file_name} at {ceph_path}")