コード例 #1
0
    def put_artifacts(
            self,
            artifacts: Sequence[metadata_store_pb2.Artifact]) -> List[int]:
        """Inserts or updates artifacts in the database.

    If an artifact_id is specified for an artifact, it is an update.
    If an artifact_id is unspecified, it will insert a new artifact.
    For new artifacts, type must be specified.
    For old artifacts, type must be unchanged or unspecified.
    When the name of an artifact is given, it should be unique among artifacts
    of the same ArtifactType.

    Args:
      artifacts: A list of artifacts to insert or update.

    Returns:
      A list of artifact ids index-aligned with the input.

    Raises:
      AlreadyExistsError: If artifact's name is specified and it is already
        used by stored artifacts of that ArtifactType.
    """
        request = metadata_store_service_pb2.PutArtifactsRequest()
        for x in artifacts:
            request.artifacts.add().CopyFrom(x)
        response = metadata_store_service_pb2.PutArtifactsResponse()

        self._call('PutArtifacts', request, response)
        result = []
        for x in response.artifact_ids:
            result.append(x)
        return result
コード例 #2
0
    def put_artifacts(
            self,
            artifacts: Sequence[metadata_store_pb2.Artifact]) -> List[int]:
        """Inserts or updates artifacts in the database.

    If an artifact_id is specified for an artifact, it is an update.
    If an artifact_id is unspecified, it will insert a new artifact.
    For new artifacts, type must be specified.
    For old artifacts, type must be unchanged or unspecified.

    Args:
      artifacts: A list of artifacts to insert or update.

    Returns:
      A list of artifact ids index-aligned with the input.
    """
        request = metadata_store_service_pb2.PutArtifactsRequest()
        for x in artifacts:
            request.artifacts.add().CopyFrom(x)
        response = metadata_store_service_pb2.PutArtifactsResponse()

        self._call('PutArtifacts', request, response)
        result = []
        for x in response.artifact_ids:
            result.append(x)
        return result