Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] flytekit uses fork when requesting remote OAuth credentials, which is not supported on Windows #5079

Open
2 tasks done
ai-rnatour opened this issue Mar 19, 2024 · 3 comments
Labels
backlogged For internal use. Reserved for contributor team workflow. bug Something isn't working flytekit FlyteKit Python related issue

Comments

@ai-rnatour
Copy link

Describe the bug

When requesting remote OAuth credentials via a user's default browser, flytekit is hardcoded to use fork to launch a background process that listens for the credential callback. Windows does not support fork, so users receive an error.

Code link

Expected behavior

flytekit should use the spawn method or, better yet, the OS default to launch this background service.

Python docs

Additional context to reproduce

No response

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@ai-rnatour ai-rnatour added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Mar 19, 2024
Copy link

welcome bot commented Mar 19, 2024

Thank you for opening your first issue here! 🛠

Copy link

dosubot bot commented Mar 19, 2024

It's great that you've identified this issue and provided a potential solution using the spawn method. Your contribution to addressing this compatibility issue for Windows users would be highly valuable. I encourage you to go ahead and create a pull request with your proposed fix. Thank you for your willingness to contribute to the project!

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@ai-rnatour
Copy link
Author

ai-rnatour commented Mar 19, 2024

I found a quick and dirty workaround by monkeypatching in a custom class to use meanwhile:

class MyAuthorizationClient(AuthorizationClient):
    def get_creds_from_remote(self) -> Credentials:
        q: Queue[Credentials] = Queue()
        server = self._create_callback_server()
        try:
            with ThreadPoolExecutor(max_workers=1) as executor:
                executor.submit(server.handle_request, q)  # no need to wait, we will receive the auth code on the queue
                self._request_authorization_code()
                auth_code = q.get()
                return self._request_access_token(auth_code)
        finally:
            server.server_close()

# monkeypatch in MyAuthorizationClient in module using flytekit
flytekit.clients.auth.authenticator.AuthorizationClient = MyAuthorizationClient

Seems to work so far but I don't expect this to be a very robust solution.

@eapolinario eapolinario added flytekit FlyteKit Python related issue backlogged For internal use. Reserved for contributor team workflow. and removed untriaged This issues has not yet been looked at by the Maintainers labels Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlogged For internal use. Reserved for contributor team workflow. bug Something isn't working flytekit FlyteKit Python related issue
Projects
None yet
Development

No branches or pull requests

2 participants