def _get_experiment(self, experiment_id, view_type=ViewType.ALL): self._check_root_dir() _validate_experiment_id(experiment_id) experiment_dir = self._get_experiment_path(experiment_id, view_type) if experiment_dir is None: raise MlflowException( "Could not find experiment with ID %s" % experiment_id, databricks_pb2.RESOURCE_DOES_NOT_EXIST, ) meta = read_yaml(experiment_dir, FileStore.META_DATA_FILE_NAME) if experiment_dir.startswith(self.trash_folder): meta["lifecycle_stage"] = LifecycleStage.DELETED else: meta["lifecycle_stage"] = LifecycleStage.ACTIVE meta["tags"] = self.get_all_experiment_tags(experiment_id) experiment = _read_persisted_experiment_dict(meta) if experiment_id != experiment.experiment_id: logging.warning( "Experiment ID mismatch for exp %s. ID recorded as '%s' in meta data. " "Experiment will be ignored.", experiment_id, experiment.experiment_id, exc_info=True, ) return None return experiment
def _get_experiment_tag_path(self, experiment_id, tag_name): _validate_experiment_id(experiment_id) _validate_param_name(tag_name) if not self._has_experiment(experiment_id): return None return os.path.join( self._get_experiment_path(experiment_id, assert_exists=True), FileStore.TAGS_FOLDER_NAME, tag_name)
def _get_experiment(self, experiment_id, view_type=ViewType.ALL): self._check_root_dir() _validate_experiment_id(experiment_id) experiment_dir = self._get_experiment_path(experiment_id, view_type) if experiment_dir is None: raise MlflowException("Could not find experiment with ID %s" % experiment_id, databricks_pb2.RESOURCE_DOES_NOT_EXIST) meta = read_yaml(experiment_dir, FileStore.META_DATA_FILE_NAME) if experiment_dir.startswith(self.trash_folder): meta['lifecycle_stage'] = Experiment.DELETED_LIFECYCLE else: meta['lifecycle_stage'] = Experiment.ACTIVE_LIFECYCLE experiment = Experiment.from_dictionary(meta) if int(experiment_id) != experiment.experiment_id: logging.warning("Experiment ID mismatch for exp %s. ID recorded as '%s' in meta data. " "Experiment will be ignored.", str(experiment_id), str(experiment.experiment_id), exc_info=True) return None return experiment
def _get_experiment_files(self, experiment_id): _validate_experiment_id(experiment_id) experiment_dir = self._get_experiment_path(experiment_id, assert_exists=True) return self._get_resource_files(experiment_dir, FileStore.EXPERIMENT_TAGS_FOLDER_NAME)