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

EBR-26 Initiate pyunicore upgrade to 1.0 #27

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
packages=setuptools.find_packages(),
install_requires=[
"jupyter_server",
"pyunicore >= 0.11.1"
"pyunicore >= 1.0"
],
zip_safe=False,
include_package_data=True,
Expand Down
14 changes: 7 additions & 7 deletions tvbextunicore/unicore_wrapper/unicore_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
#

import os

from pyunicore.client import _HBP_REGISTRY_URL
import pyunicore.client as unicore_client
from pyunicore.credentials import OIDCToken
from requests.exceptions import ConnectionError

from tvbextunicore.exceptions import TVBExtUnicoreException, ClientAuthException, \
SitesDownException, FileNotExistsException, JobRunningException
from tvbextunicore.exceptions import TVBExtUnicoreException, ClientAuthException, SitesDownException
from tvbextunicore.exceptions import FileNotExistsException, JobRunningException
from tvbextunicore.logger.builder import get_logger
from tvbextunicore.unicore_wrapper.job_dto import JobDTO

Expand All @@ -23,11 +22,12 @@
class UnicoreWrapper(object):

def __init__(self):
token = self.__retrieve_token()
token = self.__retrieve_token_str()
token = OIDCToken(token)
self.transport = self.__build_transport(token)
self.registry = unicore_client.Registry(self.transport, _HBP_REGISTRY_URL)

def __retrieve_token(self):
def __retrieve_token_str(self):
try:
from clb_nb_utils import oauth as clb_oauth
token = clb_oauth.get_token()
Expand All @@ -46,7 +46,7 @@ def __retrieve_token(self):

def __build_transport(self, token):
# type: (str) -> unicore_client.Transport
transport = unicore_client.Transport(token, oidc=True)
transport = unicore_client.Transport(token)
return transport

def __build_client(self, site):
Expand Down
Loading