Esempio n. 1
0
    def get_artifacts_by_context(
            self, context_id: int) -> List[metadata_store_pb2.Artifact]:
        """Gets all direct artifacts that a context attributes to.

    Args:
      context_id: The id of the querying context

    Returns:
      Artifacts attributing to the context.
    """
        request = metadata_store_service_pb2.GetArtifactsByContextRequest()
        request.context_id = context_id
        request.options.max_result_size = 100
        request.options.order_by_field.field = (
            metadata_store_pb2.ListOperationOptions.OrderByField.Field.
            CREATE_TIME)
        request.options.order_by_field.is_asc = False

        result = []
        while True:
            response = metadata_store_service_pb2.GetArtifactsByContextResponse(
            )
            self._call('GetArtifactsByContext', request, response)
            for x in response.artifacts:
                result.append(x)

            if not response.next_page_token:
                break

            request.options.next_page_token = response.next_page_token

        return result
Esempio n. 2
0
    def get_artifacts_by_context(
            self, context_id: int) -> List[metadata_store_pb2.Artifact]:
        """Gets all direct artifacts that a context attributes to.

    Args:
      context_id: The id of the querying context

    Returns:
      Artifacts attributing to the context.
    """
        request = metadata_store_service_pb2.GetArtifactsByContextRequest()
        request.context_id = context_id
        response = metadata_store_service_pb2.GetArtifactsByContextResponse()

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