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

Bundle store CLI commands #3828

Merged
merged 25 commits into from
Dec 14, 2021
Merged

Bundle store CLI commands #3828

merged 25 commits into from
Dec 14, 2021

Conversation

jzwang43
Copy link
Contributor

@jzwang43 jzwang43 commented Oct 10, 2021

Flow is documented here: https://github.com/codalab/codalab-worksheets/blob/f864bb2f1303bcf722e1c204d35f0c4741bc716d/docs/Multiple-Bundle-Stores.md

Reasons for making this change

Included in this PR:

cl store add --name [store name]
Creates a new bundle store, allows one to configure credentials
cl store ls
Lists all bundle stores
cl store rm [store id]
Deletes bundle store with given id
cl upload --bundle-store [store name]
Uploads a bundle and specifies the bundle store. If no bundle store is specified, the CLI will pick the optimal available bundle store.

Not included in this PR:
cl replicate [bundle uuid] --bundle-store [store name]
Replicates the contents of the specified bundle to the specified bundle store.

cl store work [store name]
All bundles will by default be uploaded to this bundle store.

cl run --bundle-store [store name]
Runs a bundle and specifies the bundle store where results are uploaded. If no bundle store is specified, the worker will pick the optimal available bundle store.

cl rm -d --bundle-store [store name]
Updates existing command “cl rm -d”; keeps the bundle, but removes the bundle contents from the specified bundle store.

Related issues

#3803
#3827

Screenshots

Checklist

  • I've added a screenshot of the changes, if this is a frontend change
  • I've added and/or updated tests, if this is a backend change
  • I've run the pre-commit.sh script
  • I've updated docs, if needed

@jzwang43 jzwang43 changed the title Mock bundle store CLI commands Bundle store CLI commands Oct 10, 2021
@jzwang43 jzwang43 linked an issue Oct 10, 2021 that may be closed by this pull request
@@ -32,12 +44,10 @@ def test_bundle_store_workflow(self):
bundle_stores = self.bundle_manager._model.get_bundle_stores(self.user_id)
self.assertEqual(len(bundle_stores), 1)
self.assertEqual(bundle_stores[0].get("name"), "im-not-a-store")
# delete the store
# Deletion should succeed since there are bundle locations associated with the bundle store
Copy link
Member

@epicfaace epicfaace Dec 12, 2021

Choose a reason for hiding this comment

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

FYI @adiprerepa I think your test had the opposite behavior / reverse logic, I had to reverse the logic here to get it to work correctly.

@epicfaace epicfaace mentioned this pull request Dec 13, 2021
@epicfaace epicfaace marked this pull request as ready for review December 13, 2021 02:18
"""
return local.model.delete_bundle_store(request.user.user_id, uuid)
uuids = get_resource_ids(request.json, 'bundle_stores')
Copy link
Member

Choose a reason for hiding this comment

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

FYI @adiprerepa @andyjin2000 I had to change these REST endpoints to all accept data / return data in bulk, because that is the kind of REST endpoint that json_api_client.py uses. I'm happy to have a call later to discuss these changes further -- because I think it will help us to know how to best make REST endpoints in the future!


class Meta:
type_ = 'bundle-store'
type_ = 'bundle_stores'
Copy link
Member

Choose a reason for hiding this comment

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

The type name must match the endpoint URL (/bundle_stores) as per how our json api client works

## Steps to set up GCP

```
cl store add --name gcp --storage-type gcp --url gcs://bucket1
Copy link
Member

Choose a reason for hiding this comment

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

Upcoming in #3905!

@epicfaace epicfaace removed their assignment Dec 13, 2021
@jzwang43
Copy link
Contributor Author

jzwang43 commented Dec 13, 2021

@epicfaace Looks like some of the CLI tests are failing so I can't merge this right now. I think they are related to cl upload.

@jzwang43 jzwang43 mentioned this pull request Dec 13, 2021
4 tasks
@mergify mergify bot merged commit 9220efa into master Dec 14, 2021
@mergify mergify bot deleted the bundle-store-cli branch December 14, 2021 15:30
@jzwang43 jzwang43 mentioned this pull request Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up mock bundle store CLI commands
2 participants