Esempio n. 1
0
def _save_logs_to_mlflow(logs: Optional[skein.model.ApplicationLogs],
                         containers: Dict[str, Tuple[str, str]], n_try: int):
    if not logs:
        return

    for key, logs in logs.items():
        if key in containers:
            task, status = containers[key]
            filename = mlflow.format_key(f"{task}_{status}_{n_try}")
        else:
            filename = mlflow.format_key(f"{key}_{n_try}")
        mlflow.save_text_to_mlflow(logs, filename)
Esempio n. 2
0
    def log_mlflow(self, n_try: int):
        content = ""
        for metric_name, value in self._asdict().items():
            if isinstance(value, dict):
                for k, v in value.items():
                    if v:
                        formatted_key = mlflow.format_key(f"{metric_name}_{k}_{n_try}")
                        content = content + f"{formatted_key}: {v.total_seconds()} secs\n"
            else:
                if value:
                    formatted_key = mlflow.format_key(f"{metric_name}_{n_try}")
                    content = content + f"{formatted_key}: {value.total_seconds()} secs\n"

        mlflow.save_text_to_mlflow(content, "tf_yarn_duration_stats")