Exemplo n.º 1
0
 def get_trial(self, trial_id: int) -> trial.TrialReference:
     """
     Get the :class:`~determined.experimental.TrialReference` representing the
     trial with the provided trial ID.
     """
     return trial.TrialReference(trial_id, self._session._master,
                                 self._trials)
Exemplo n.º 2
0
    def get_trials(
        self,
        sort_by: trial.TrialSortBy = trial.TrialSortBy.ID,
        order_by: trial.TrialOrderBy = trial.TrialOrderBy.ASCENDING,
    ) -> List[trial.TrialReference]:
        """
        Get the list of :class:`~determined.experimental.TrialReference` instances
        representing trials for an experiment.

        Arguments:
            sort_by: Which field to sort by. See :class:`~determined.experimental.TrialSortBy`.
            order_by: Whether to sort in ascending or descending order. See
                :class:`~determined.experimental.TrialOrderBy`.
        """
        r = self._session.get(
            f"/api/v1/experiments/{self.id}/trials",
            params={
                "sort_by": sort_by.value,
                "order_by": order_by.value,
            },
        )
        trials = r.json()["trials"]
        return [trial.TrialReference(t["id"], self._session) for t in trials]