Esempio n. 1
0
    def get_attributes(self):
        """
        Gets all attributes from this dataset.

        Returns
        -------
        dict of str to {None, bool, float, int, str}
            Names and values of all attributes.

        """
        self._refresh_cache()
        return _utils.unravel_key_values(self._msg.attributes)
Esempio n. 2
0
    def __repr__(self):
        self._refresh_cache()
        msg = self._msg

        return '\n'.join((
            "name: {}".format(msg.name),
            "url: {}://{}/{}/datasets/{}/summary".format(self._conn.scheme, self._conn.socket, self.workspace, self.id),
            "time created: {}".format(_utils.timestamp_to_str(int(msg.time_created))),
            "time updated: {}".format(_utils.timestamp_to_str(int(msg.time_updated))),
            "description: {}".format(msg.description),
            "tags: {}".format(msg.tags),
            "attributes: {}".format(_utils.unravel_key_values(msg.attributes)),
            "id: {}".format(msg.id),
        ))
Esempio n. 3
0
    def __repr__(self):
        self._refresh_cache()
        msg = self._msg

        return '\n'.join((
            "version: {}".format(msg.version),
            # TODO: "url: {}://{}/{}/datasets/{}/summary".format(self._conn.scheme, self._conn.socket, self.workspace, self.id),
            "time created: {}".format(
                _utils.timestamp_to_str(int(msg.time_logged))),
            "time updated: {}".format(
                _utils.timestamp_to_str(int(msg.time_updated))),
            "description: {}".format(msg.description),
            "tags: {}".format(msg.tags),
            "attributes: {}".format(_utils.unravel_key_values(msg.attributes)),
            "id: {}".format(msg.id),
            "content:",
            "{}".format(self.get_content()),  # TODO: increase indentation
        ))
Esempio n. 4
0
    def get_attributes(self):
        """
        Gets all attributes from this Model Version.

        Returns
        -------
        dict of str to {None, bool, float, int, str}
            Names and values of all attributes.

        """
        self._refresh_cache()
        attributes = _utils.unravel_key_values(self._msg.attributes)
        for key, attribute in attributes.items():
            try:
                attributes[key] = data_types._VertaDataType._from_dict(
                    attribute)
            except (KeyError, TypeError, ValueError):
                pass
        return attributes
Esempio n. 5
0
    def __repr__(self):
        self._refresh_cache()
        msg = self._msg
        artifact_keys = self.get_artifact_keys()
        if self.has_model:
            artifact_keys.append(self._MODEL_KEY)

        return "\n".join((
            "version: {}".format(msg.version),
            "stage: {}".format(self.stage),
            "lock level: {}".format(
                _RegistryService.ModelVersionLockLevelEnum.
                ModelVersionLockLevel.Name(msg.lock_level).lower()),
            "url: {}://{}/{}/registry/{}/versions/{}".format(
                self._conn.scheme,
                self._conn.socket,
                self.workspace,
                self.registered_model_id,
                self.id,
            ),
            "time created: {}".format(
                _utils.timestamp_to_str(int(msg.time_created))),
            "time updated: {}".format(
                _utils.timestamp_to_str(int(msg.time_updated))),
            "description: {}".format(msg.description),
            "labels: {}".format(msg.labels),
            "attributes: {}".format({
                key: val
                for key, val in _utils.unravel_key_values(
                    msg.attributes).items()
                if not key.startswith(_deployable_entity._INTERNAL_ATTR_PREFIX)
            }),
            "id: {}".format(msg.id),
            "registered model id: {}".format(msg.registered_model_id),
            "experiment run id: {}".format(msg.experiment_run_id),
            # "archived status: {}".format(msg.archived == _CommonCommonService.TernaryEnum.TRUE),
            "artifact keys: {}".format(artifact_keys),
        ))