-
Notifications
You must be signed in to change notification settings - Fork 47
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
add logout to funcx endpoint #909
Conversation
This pull request has been linked to Shortcut Story #18074: Support FuncX endpoint logout. |
See above screenshot for example usage - First funcx_endpoint start forces login (no previous logins). Second 'start' does not require re-auth as expected, after 'logout', 3rd start requires re-auth (confirming logout token clearing), and if login is aborted, 2nd 'logout' shows that no tokens were found to revoke |
170fd52
to
36f911a
Compare
@sirosen LoginManager.logout was your original code, putting this on your radar in case you had any comments on whether we should support resource_server specific logouts or if you mind the bool return value of if tokens were found and removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks generally on target, save for a suggestion regarding giving more information to the user.
The one thing that does appear to be lacking is tests.
36f911a
to
df18c2d
Compare
Is this ... expected behavior?
As I didn't specify an environment ... what do we expect to happen? From which environment did it attempt log me out? Perhaps |
Kevin asked me for my thoughts on this, so very briefly:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few, let me know if you have any questions.
So with Josh's suggestion below, I'll remove the environment param altogether for now.
Yes the resource_server ones are entwined anyway for most consents and most users don't care about individual ones. Especially in this case, removing individual ones aren't relevant to the original shortcut story. Removing references and logic here.
Adding a --force option re: Josh currently running endpoints which will require a bit more refactoring in the next commit. |
df18c2d
to
824eaac
Compare
See other comments - removed --environment as I mostly agree with sirosen and Josh that it is too dev-specific, but did change the resulting user-facing output |
Let's discuss offline, but as logout_endpoint just calls LoginManager.logout directly, there isn't much PR specific logic to test. (most of the logic is Click option related, the rest LoginManager related, so should be added in separate PR if desired IMO). The get_running_endpoints() refactor is slightly testable but not much. |
edit |
583007a
to
c4e719c
Compare
35e374b
to
c0f13a7
Compare
Redid the logout messages (in log.info and in ClickException command return). See all 4 scenarios below: (In order, they are 1) Logout failure with running endpoint 2) Logout success with running endpoint and --force 3) logout success with no running endpoints 4) logout failure when tokens were already cleared |
c0f13a7
to
54c06f1
Compare
modify erorr message lint formatting tmp mypy and lint
54c06f1
to
e84feba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, mate! That was the "5-minute" PR from hell, right? Heh.
@joshbryan-globus I think the --force flag resolves the comment? But it's still showing changes requested. You may have to click something again |
Added logout subcommand to funcx-endpoint. See linked SC: https://app.shortcut.com/funcx/story/18074/support-funcx-endpoint-logout
There is a slight modification to funcx_sdk.funcx.sdk.login_manager.manager.logout to return bool instead, plus see the associated TODO comment.
I expect to remove the TODO in LoginManager.logout and funcx_endpoint.cli.logout_endpoint before merging (the TODOs are to ensure PR comment)
EDIT all the TODOs were removed along with most of the proposed (and rejected) extra logic/params.