Skip to content

Commit

Permalink
Merge pull request #27 from the-virtual-brain/EBR-26
Browse files Browse the repository at this point in the history
WIP: EBR-26 Initiate pyunicore upgrade to 1.0
  • Loading branch information
liadomide authored Apr 2, 2024
2 parents 0f4762a + c2f045f commit 3396c16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 3396c16

Please sign in to comment.