From dc572ccbc856346268c47662b1e3c0dbcaf29e70 Mon Sep 17 00:00:00 2001 From: Jens Henrik Goebbert <j.goebbert@fz-juelich.de> Date: Sun, 9 Jun 2024 13:04:36 +0200 Subject: [PATCH] update for pyunicore 1.0.0 --- .../1-hdf-cloud_mount-hpc-storage.ipynb | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/day2_hpcenv/7_cloud-hpc_challenges/1-hdf-cloud_mount-hpc-storage.ipynb b/day2_hpcenv/7_cloud-hpc_challenges/1-hdf-cloud_mount-hpc-storage.ipynb index 771502c..fc37e13 100644 --- a/day2_hpcenv/7_cloud-hpc_challenges/1-hdf-cloud_mount-hpc-storage.ipynb +++ b/day2_hpcenv/7_cloud-hpc_challenges/1-hdf-cloud_mount-hpc-storage.ipynb @@ -131,8 +131,20 @@ "source": [ "def get_mount_command(access_token):\n", " _auth = \"https://uftp.fz-juelich.de:9112/UFTP_Auth/rest/auth/\"\n", - " _tr = unicore_client.Transport(access_token)\n", - " _info = _tr.get(url=_auth)\n", + " try:\n", + " _tr = unicore_client.Transport(access_token)\n", + " _info = _tr.get(url=_auth)\n", + " except AttributeError:\n", + " # pyunicore 1.0.0 has a different API\n", + " import pyunicore.credentials as unicore_credentials\n", + " credential = unicore_credentials.OIDCToken(access_token, None)\n", + " transport_kwargs = {\n", + " \"credential\": credential,\n", + " \"verify\": False,\n", + " \"timeout\": 30\n", + " }\n", + " _tr = unicore_client.Transport(**transport_kwargs)\n", + " _info = _tr.get(url=_auth)\n", " _uid = _info[\"JUDAC\"][\"uid\"]\n", "\n", " remote_base_dir = \"/p/home/jusers/%s\" % _uid\n", @@ -224,6 +236,14 @@ "# unmount\n", "!fusermount -u $HOME/uftp-mount-rw" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0c2fb3a-549c-4993-86d8-b2fc2c7dbdc5", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -242,7 +262,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.11.3" } }, "nbformat": 4, -- GitLab