Exemple #1
0
    def list_launch_plans_paginated(self,
                                    identifier,
                                    limit=100,
                                    token=None,
                                    filters=None,
                                    sort_by=None):
        """
        This returns a page of launch plan meta-information for launch plans in a given project and domain.  Optionally,
        specifying a name will limit the results to only workflows with that name in the 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 flytekit.models.common.NamedEntityIdentifier identifier: NamedEntityIdentifier to list.
        :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 int 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.launch_plan.LaunchPlan], str
        """
        lp_list = super(
            SynchronousFlyteClient, self).list_launch_plans_paginated(
                resource_list_request=_common_pb2.ResourceListRequest(
                    id=identifier.to_flyte_idl(),
                    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(
                    ),
                ))
        # TODO: tmp workaround
        for pb in lp_list.launch_plans:
            pb.id.resource_type = _identifier.ResourceType.LAUNCH_PLAN
        return (
            [
                _launch_plan.LaunchPlan.from_flyte_idl(pb)
                for pb in lp_list.launch_plans
            ],
            _six.text_type(lp_list.token),
        )
Exemple #2
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),
        )