Exemplo n.º 1
0
    def __init__(self, url, insecure=False, credentials=None, options=None):
        """
        Initializes a gRPC channel to the given Flyte Admin service.

        :param Text url: The URL (including port if necessary) to connect to the appropriate Flyte Admin Service.
        :param bool insecure: [Optional] Whether to use an insecure connection, default False
        :param Text credentials: [Optional] If provided, a secure channel will be opened with the Flyte Admin Service.
        :param dict[Text, Text] options: [Optional] A dict of key-value string pairs for configuring the gRPC core
            runtime.
        :param list[(Text,Text)] metadata: [Optional] metadata pairs to be transmitted to the
            service-side of the RPC.
        """
        self._channel = None
        self._url = url

        if insecure:
            self._channel = _insecure_channel(url,
                                              options=list((options
                                                            or {}).items()))
        else:
            self._channel = _secure_channel(
                url,
                credentials or _ssl_channel_credentials(),
                options=list((options or {}).items()),
            )
        self._stub = _admin_service.AdminServiceStub(self._channel)
        self._metadata = None
        if _AUTH.get():
            self.force_auth_flow()
Exemplo n.º 2
0
    def __init__(self, url, insecure=False, credentials=None, options=None):
        """
        Initializes a gRPC channel to the given Flyte Admin service.

        :param Text url: The URL (including port if necessary) to connect to the appropriate Flyte Admin Service.
        :param bool insecure: [Optional] Whether to use an insecure connection, default False
        :param Text credentials: [Optional] If provided, a secure channel will be opened with the Flyte Admin Service.
        :param dict[Text, Text] options: [Optional] A dict of key-value string pairs for configuring the gRPC core
            runtime.
        """
        self._channel = None

        # TODO: Revert all the for loops below
        if insecure:
            self._channel = _insecure_channel(url, options=list((options or {}).items()))
        else:
            self._channel = _secure_channel(
                url,
                credentials or _ssl_channel_credentials(),
                options=list((options or {}).items())
            )
        self._stub = _admin_service.AdminServiceStub(self._channel)