-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from DLHub-Argonne/dev
Dev -- funcx 1.0.x compatibility
- Loading branch information
Showing
4 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from __future__ import annotations | ||
|
||
import logging | ||
import globus_sdk | ||
from globus_sdk.scopes import AuthScopes, SearchScopes | ||
from funcx.sdk.web_client import FuncxWebClient | ||
from funcx import FuncXClient | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class FuncXLoginManager: | ||
""" | ||
Implements the funcx.sdk.login_manager.protocol.LoginManagerProtocol class. | ||
https://github.com/funcx-faas/funcX/blob/main/funcx_sdk/funcx/sdk/login_manager/protocol.py#L18 | ||
""" | ||
SCOPES = [ | ||
FuncXClient.FUNCX_SCOPE, | ||
AuthScopes.openid, | ||
SearchScopes.all | ||
] | ||
|
||
def __init__(self, authorizers: dict[str, globus_sdk.RefreshTokenAuthorizer]): | ||
self.authorizers = authorizers | ||
|
||
def get_auth_client(self) -> globus_sdk.AuthClient: | ||
return globus_sdk.AuthClient( | ||
authorizer=self.authorizers[AuthScopes.openid] | ||
) | ||
|
||
def get_search_client(self) -> globus_sdk.SearchClient: | ||
return globus_sdk.SearchClient( | ||
authorizer=self.authorizers[SearchScopes.all] | ||
) | ||
|
||
def get_funcx_web_client( | ||
self, *, base_url: str | None = None, app_name: str | None = None | ||
) -> FuncxWebClient: | ||
return FuncxWebClient( | ||
base_url=base_url, | ||
app_name=app_name, | ||
authorizer=self.authorizers[FuncXClient.FUNCX_SCOPE], | ||
) | ||
|
||
def ensure_logged_in(self): | ||
log.warning("ensure_logged_in cannot be invoked from here!") | ||
|
||
def logout(self): | ||
log.warning("logout cannot be invoked from here!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ globus-sdk>=3,<4 | |
requests>=2.24.0 | ||
mdf_toolbox>=0.5.4 | ||
jsonschema>=3.2.0 | ||
funcx>=0.3.6 | ||
funcx>=1.0.0 | ||
pydantic |