コード例 #1
0
    def set_trial_status(self, trial, status, heartbeat=None, was=None):
        """Update the trial status and the heartbeat

        Raises
        ------
        FailedUpdate
            The exception is raised if the status of the trial object
            does not match the status in the database

        """
        was = was or trial.status

        validate_status(status)
        validate_status(was)
        try:
            result_trial = self.backend.fetch_and_update_trial(
                {
                    "uid": trial.id,
                    "status": get_track_status(was)
                },
                "set_trial_status",
                status=get_track_status(status),
            )

        except ItemNotFound as e:
            raise FailedUpdate() from e

        trial.status = status
        return result_trial
コード例 #2
0
ファイル: track.py プロジェクト: vincehass/orion
    def set_trial_status(self, trial, status, heartbeat=None):
        """Update the trial status and the heartbeat

        Raises
        ------
        FailedUpdate
            The exception is raised if the status of the trial object
            does not match the status in the database

        """
        validate_status(status)
        try:
            result_trial = self.backend.fetch_and_update_trial(
                {
                    'uid': trial.id,
                    'status': get_track_status(trial.status)
                },
                'set_trial_status',
                status=get_track_status(status))

        except ItemNotFound as e:
            raise FailedUpdate() from e

        trial.status = status
        return result_trial
コード例 #3
0
    def set_trial_status(self, trial, status, heartbeat=None):
        """See :func:`orion.storage.base.BaseStorageProtocol.set_trial_status`"""
        if heartbeat is None:
            heartbeat = datetime.datetime.utcnow()

        update = dict(status=status,
                      heartbeat=heartbeat,
                      experiment=trial.experiment)

        validate_status(status)

        rc = self.update_trial(trial,
                               **update,
                               where={
                                   "status": trial.status,
                                   "_id": trial.id
                               })

        if not rc:
            raise FailedUpdate()

        trial.status = status