def list_experiments( self, view_type=ViewType.ACTIVE_ONLY, max_results=None, page_token=None, ): """ :param view_type: Qualify requested type of experiments. :param max_results: If passed, specifies the maximum number of experiments desired. If not passed, all experiments will be returned. :param page_token: Token specifying the next page of results. It should be obtained from a ``list_experiments`` call. :return: A :py:class:`PagedList <mlflow.store.entities.PagedList>` of :py:class:`Experiment <mlflow.entities.Experiment>` objects. The pagination token for the next page can be obtained via the ``token`` attribute of the object. """ from mlflow.utils.search_utils import SearchUtils from mlflow.store.entities.paged_list import PagedList _validate_list_experiments_max_results(max_results) self._check_root_dir() rsl = [] if view_type == ViewType.ACTIVE_ONLY or view_type == ViewType.ALL: rsl += self._get_active_experiments(full_path=False) if view_type == ViewType.DELETED_ONLY or view_type == ViewType.ALL: rsl += self._get_deleted_experiments(full_path=False) experiments = [] for exp_id in rsl: try: # trap and warn known issues, will raise unexpected exceptions to caller experiment = self._get_experiment(exp_id, view_type) if experiment: experiments.append(experiment) except MissingConfigException as rnfe: # Trap malformed experiments and log warnings. logging.warning( "Malformed experiment '%s'. Detailed error %s", str(exp_id), str(rnfe), exc_info=True, ) if max_results is not None: experiments, next_page_token = SearchUtils.paginate( experiments, page_token, max_results ) return PagedList(experiments, next_page_token) else: return PagedList(experiments, None)
def list_experiments( self, view_type=ViewType.ACTIVE_ONLY, max_results=None, page_token=None, ): """ :param view_type: Qualify requested type of experiments. :param max_results: If passed, specifies the maximum number of experiments desired. If not passed, all experiments will be returned. :param page_token: Token specifying the next page of results. It should be obtained from a ``list_experiments`` call. :return: A :py:class:`PagedList <mlflow.store.entities.PagedList>` of :py:class:`Experiment <mlflow.entities.Experiment>` objects. The pagination token for the next page can be obtained via the ``token`` attribute of the object. """ _validate_list_experiments_max_results(max_results) return self._list_experiments( view_type=view_type, max_results=max_results, page_token=page_token, eager=True )