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

feat: add polybox storage #527

Merged
merged 16 commits into from
Dec 3, 2024

Conversation

andre-code
Copy link
Contributor

PR to modify cloud storage schema to add polybox storage

/deploy

@RenkuBot
Copy link
Contributor

You can access the deployment of this PR at https://renku-ci-ds-527.dev.renku.ch

@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from bd555db to f567310 Compare November 12, 2024 13:02
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from f567310 to 2896ebc Compare November 12, 2024 13:08
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from 2896ebc to aadc15c Compare November 12, 2024 13:21
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from aadc15c to df5e967 Compare November 12, 2024 13:28
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from df5e967 to df14d60 Compare November 12, 2024 13:38
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from df14d60 to f0e351d Compare November 12, 2024 14:28
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from f0e351d to dfa1925 Compare November 13, 2024 10:17
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from dfa1925 to e6dd8cf Compare November 13, 2024 10:53
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from e6dd8cf to 83b1acb Compare November 14, 2024 08:07
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from 9a4b60d to 207b3d4 Compare November 14, 2024 08:15
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from 207b3d4 to 9c4f0a7 Compare November 14, 2024 10:24
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from f4a6f1d to 26c6e3c Compare November 14, 2024 10:46
@andre-code andre-code force-pushed the andrea/3392-add-polybox-switchdrive-schema branch from 26c6e3c to 578240d Compare November 14, 2024 10:58
@andre-code andre-code changed the title [wip] feat: add polybox storage feat: add polybox storage Nov 22, 2024
@andre-code andre-code marked this pull request as ready for review November 22, 2024 10:27
@andre-code andre-code requested a review from a team as a code owner November 22, 2024 10:27
Copy link
Member

@Panaetius Panaetius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks really good, there's just some issues related to idiosyncracies of the rlcone schema.

Comment on lines 230 to 235
if access == "shared" and storage_type == "switchDrive":
self.configuration["url"] = "https://drive.switch.ch/public.php/webdav/"
if access == "personal" and storage_type == "polybox":
self.configuration["url"] = "https://polybox.ethz.ch/remote.php/webdav/"
if access == "personal" and storage_type == "switchDrive":
self.configuration["url"] = "https://drive.switch.ch/remote.php/webdav/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: these should be elif since they're mutually exclusive.

@@ -156,6 +157,91 @@ def __patch_schema_remove_oauth_propeties(spec: list[dict[str, Any]]) -> None:
options.append(option)
storage["Options"] = options

@staticmethod
def __find_webdav_storage(spec: list[dict[str, Any]]) -> dict[str, Any]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this is too specific to me, I think having _find_storage(prefix: str) would be cleaner and there might be some other places where we could use that as well,e.g. in __patch_schema_add_switch_provider

"IsPassword": False,
"NoPrefix": False,
"Advanced": False,
"Exclusive": False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Exclusive should be True, this means that only the values in Examples are valid values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks for clarify that

"Provider": "",
},
],
"Required": False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: this field is mandatory, no? Especially since it doesn't have a default set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is


custom_options = [
{
"Name": "access",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: I'm a bit confused by this, this is a field called access, but lower down its values are used as provider. In rclone schemas, the providers should be in the field provider by convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see where the confusion came from. I was trying to make it flexible by adding an option for access (personal and shared), but it ended up being a bit unclear. I’ll change it so the modes are set in the provider options instead, and I’ll use the provider property to specify when an option applies to a specific mode (personal or shared).

- make __find_webdav_storage as more reusable function
- use provider option for set the personal and shared modes instead of creating an option for it
- clean up code
@@ -176,36 +176,10 @@ def __add_webdav_based_storage(
) -> None:
"""Create a modified copy of WebDAV storage and add it to the schema."""
# Find WebDAV storage schema and create a modified copy
storage_copy = RCloneValidator.__find_webdav_storage(spec)
storage_copy = RCloneValidator.__find_storage(spec, "webDav")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
storage_copy = RCloneValidator.__find_storage(spec, "webDav")
storage_copy = RCloneValidator.__find_storage(spec, "webdav")

I think this is a typo? at least it was lower case before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is. thanks!

Comment on lines +219 to +242

# Transform configuration for polybox or switchDrive
storage_type = self.configuration.get("type", "")
access = self.configuration.get("provider", "")

if storage_type == "polybox" or storage_type == "switchDrive":
self.configuration["type"] = "webdav"
self.configuration["provider"] = ""

if access == "shared" and storage_type == "polybox":
self.configuration["url"] = "https://polybox.ethz.ch/public.php/webdav/"
elif access == "shared" and storage_type == "switchDrive":
self.configuration["url"] = "https://drive.switch.ch/public.php/webdav/"
elif access == "personal" and storage_type == "polybox":
self.configuration["url"] = "https://polybox.ethz.ch/remote.php/webdav/"
elif access == "personal" and storage_type == "switchDrive":
self.configuration["url"] = "https://drive.switch.ch/remote.php/webdav/"

# Extract the user from the public link
if access == "shared" and storage_type in {"polybox", "switchDrive"}:
public_link = self.configuration.get("public_link", "")
user_identifier = public_link.split("/")[-1]
self.configuration["user"] = user_identifier

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just as a reminder, these changes also need to be backported to https://github.com/SwissDataScienceCenter/renku-notebooks/blob/master/renku_notebooks/api/schemas/cloud_storage.py#L155 to work with Renku v1.

@andre-code andre-code merged commit b687dd6 into main Dec 3, 2024
17 checks passed
@andre-code andre-code deleted the andrea/3392-add-polybox-switchdrive-schema branch December 3, 2024 12:22
@RenkuBot
Copy link
Contributor

RenkuBot commented Dec 3, 2024

Tearing down the temporary RenkuLab deplyoment for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants