Exemplo n.º 1
0
    def to_flyte_idl(self):
        """
        Stores object to a Flyte-IDL defined protobuf.
        :rtype: flyteidl.admin.common_pb2.NamedEntityIdentifier
        """

        # We use the kwarg constructor of the protobuf and setting name=None is equivalent to not setting it at all
        return _common_pb2.NamedEntityIdentifier(project=self.project, domain=self.domain, name=self.name)
Exemplo n.º 2
0
 def to_flyte_idl(self):
     """
     :rtype: flyteidl.admin.common_pb2.NamedEntityIdentifier
     """
     return _common.NamedEntityIdentifier(
         project=self.project,
         domain=self.domain,
         name=self.name,
     )
Exemplo n.º 3
0
    def list_executions_paginated(self,
                                  project,
                                  domain,
                                  limit=100,
                                  token=None,
                                  filters=None,
                                  sort_by=None):
        """
        This returns a page of executions in a given project and domain.

        .. note ::

            This is a paginated API.  Use the token field in the request to specify a page offset token.
            The user of the API is responsible for providing this token.

        .. note ::

            If entries are added to the database between requests for different pages, it is possible to receive
            entries on the second page that also appeared on the first.

        :param Text project: Project in which to list executions.
        :param Text domain: Project in which to list executions.
        :param int limit: [Optional] The maximum number of entries to return.  Must be greater than 0.  The maximum
            page size is determined by the Flyte Admin Service configuration.  If limit is greater than the maximum
            page size, an exception will be raised.
        :param Text token: [Optional] If specified, this specifies where in the rows of results to skip before reading.
            If you previously retrieved a page response with token="foo" and you want the next page,
            specify token="foo". Please see the notes for this function about the caveats of the paginated API.
        :param list[flytekit.models.filters.Filter] filters: [Optional] If specified, the filters will be applied to
            the query.  If the filter is not supported, an exception will be raised.
        :param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
        :raises: TODO
        :rtype: (list[flytekit.models.execution.Execution], Text)
        """
        exec_list = super(
            SynchronousFlyteClient, self).list_executions_paginated(
                resource_list_request=_common_pb2.ResourceListRequest(
                    id=_common_pb2.NamedEntityIdentifier(project=project,
                                                         domain=domain),
                    limit=limit,
                    token=token,
                    filters=_filters.FilterList(filters or []).to_flyte_idl(),
                    sort_by=None if sort_by is None else sort_by.to_flyte_idl(
                    ),
                ))
        return (
            [
                _execution.Execution.from_flyte_idl(pb)
                for pb in exec_list.executions
            ],
            _six.text_type(exec_list.token),
        )