Skip to content

Commit

Permalink
Dir path for communitydata
Browse files Browse the repository at this point in the history
  • Loading branch information
kks32 committed Oct 31, 2023
1 parent c605e66 commit d60acea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions dsjobs/dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/test_dir_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d60acea

Please sign in to comment.