From d60aceaba76e356222636f4c7828f01936fdb3d3 Mon Sep 17 00:00:00 2001 From: Krishna Kumar Date: Mon, 30 Oct 2023 21:04:24 -0500 Subject: [PATCH] Dir path for communitydata --- dsjobs/dir.py | 14 +++++++------- tests/test_dir_uri.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dsjobs/dir.py b/dsjobs/dir.py index 2f1b28e..f2325e8 100644 --- a/dsjobs/dir.py +++ b/dsjobs/dir.py @@ -19,17 +19,17 @@ def get_ds_path_uri(ag, path): # If any of the following directory patterns are found in the path, # process them accordingly. directory_patterns = [ - ("jupyter/MyData", "designsafe.storage.default"), - ("jupyter/mydata", "designsafe.storage.default"), - ("jupyter/CommunityData", "designsafe.storage.community"), - ("/MyData", "designsafe.storage.default"), - ("/mydata", "designsafe.storage.default"), + ("jupyter/MyData", "designsafe.storage.default", True), + ("jupyter/mydata", "designsafe.storage.default", True), + ("jupyter/CommunityData", "designsafe.storage.community", False), + ("/MyData", "designsafe.storage.default", True), + ("/mydata", "designsafe.storage.default", True), ] - for pattern, storage in directory_patterns: + for pattern, storage, use_username in directory_patterns: if pattern in path: path = path.split(pattern).pop() - input_dir = ag.profiles.get()["username"] + path + input_dir = ag.profiles.get()["username"] + path if use_username else path input_uri = f"agave://{storage}/{input_dir}" return input_uri.replace(" ", "%20") diff --git a/tests/test_dir_uri.py b/tests/test_dir_uri.py index ca14ea5..3a26d4e 100644 --- a/tests/test_dir_uri.py +++ b/tests/test_dir_uri.py @@ -28,7 +28,7 @@ def test_directory_patterns(self, mock_path_exists): ), ( "jupyter/CommunityData/communitypath", - "agave://designsafe.storage.community/testuser/communitypath", + "agave://designsafe.storage.community//communitypath", ), ] for path, expected in test_cases: