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

Handle hardware, storage, secrets and variables when creating or duplicating repos #1457

Closed
6 tasks done
Wauplin opened this issue Apr 27, 2023 · 2 comments
Closed
6 tasks done
Labels
enhancement New feature or request good first issue Good for newcomers spaces

Comments

@Wauplin
Copy link
Contributor

Wauplin commented Apr 27, 2023

With the new reworked duplicate modal, one can set both hardware, storage, secrets and variables directly when duplicating a Space. We should reflect that in huggingface_hub. See https://github.com/huggingface/moon-landing/pull/6159 (internal link).

cc @SBrandeis


Requested features in this issue can be implemented in separate PRs if it makes it easier.

  • handle hardware + sleep_time in duplicate_repo
  • handle hardware + sleep_time in create_repo
  • handle storage in duplicate_repo
  • handle storage in create_repo
  • handle secrets + variables in duplicate_repo
  • handle secrets + variables in create_repo

EDIT: everything got implemented in #1625 by @martinbrose !


The idea is to extend the duplicate_space method in hf_api.py. Currently, repository and private parameters are sent in the payload. New parameters should be supported as well:

  • hardware: used to request hardware for the duplicated Space. Must be of type SpaceHardware.
  • storageTier: used to request persistent storage for the duplicated Space. Must be of type SpaceStorage (see Add support for Space Persistent Storage #1553)
  • sleepTimeSeconds: set a custom sleep time if upgraded hardware is used. Must be of type int. See set_space_sleep_time method as an example.
  • secrets: list of secrets to set on the Space
  • variables: list of variables to set on the Space

For secrets and variables, input type must be List[Dict[str, str]]. For each secret/variable, key and value are mandatory. A third item description is optional. Example: [{"key": "MY_SECRET_KEY_1", "value": "MY_SECRET_VALUE_1"}, {"key": ..., "value": ..., "description": "This is a description."}, ...]. Description is then displayed in the UI for a better user experience.

By default, all parameters are Optional in Python with default value None. Value must be sent in json payload only if not None.

Once implemented, tests must be added to HfApiDuplicateSpaceTest class (in test_hf_api.py). 1 test for hardware + sleep_time , 1 test for storage and 1 test for secrets + variables should be enough.


Similarly to the duplicate endpoint, config values like hardware, storage, sleep time, secrets and variables should be supported on the create_repo endpoint. Requirements are exactly the same as above.

@Wauplin Wauplin added this to the in next release? milestone May 24, 2023
@Wauplin Wauplin removed this from the in next release? milestone Jul 4, 2023
@Wauplin Wauplin added the good first issue Good for newcomers label Jul 4, 2023
@Wauplin Wauplin changed the title Handle hardware and secrets when duplicating repos Handle hardware, secrets and variables when duplicating repos Jul 11, 2023
@Wauplin Wauplin changed the title Handle hardware, secrets and variables when duplicating repos Handle hardware, secrets and variables when creating or duplicating repos Jul 11, 2023
@Wauplin Wauplin changed the title Handle hardware, secrets and variables when creating or duplicating repos Handle hardware, storage, secrets and variables when creating or duplicating repos Jul 11, 2023
@Wauplin Wauplin added enhancement New feature or request spaces labels Jul 11, 2023
@martinbrose
Copy link
Contributor

@Wauplin, I think this can be closed now?

@Wauplin
Copy link
Contributor Author

Wauplin commented Sep 7, 2023

Yes indeed! Closing as part of #1625. Thanks for noticing :)

@Wauplin Wauplin closed this as completed Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers spaces
Projects
None yet
Development

No branches or pull requests

2 participants