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

update import and create-dataset shortcuts to require full path #217

Merged
merged 20 commits into from
Jan 11, 2018

Conversation

jsh2134
Copy link
Contributor

@jsh2134 jsh2134 commented Dec 20, 2017

  • update the upload and create-dataset shortcuts to require a dataset full path (breaking change that removes --vault and --path) from those commands
  • add validation code to objects and vaults and add some incomplete path inference

Copy link
Member

@davecap davecap left a comment

Choose a reason for hiding this comment

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

Let's discuss tomorrow.

README.md Outdated
@@ -234,11 +234,11 @@ remained unchanged.
The `objects` property of a resource has been renamed `solve_objects`.

6. The `import` and `create-dataset` command-line utilities now require
`--vault` and `--path` arguments. The `dataset` argument (`test-dataset`
`--dataset_full_path` arguments. The `dataset` argument (`test-dataset`
Copy link
Member

Choose a reason for hiding this comment

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

isn't it --dataset-full-path ? maybe it should just be --full-path?

README.md Outdated
below) no longer can contain slashes.

```
create-dataset --capacity=small --vault=test --path=/ test-dataset
create-dataset --capacity=small --dataset_ful_path=acme:test:/examples test-dataset
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a typo.

@@ -103,8 +90,8 @@ class SolveArgumentParser(argparse.ArgumentParser):
'Options are "append" (default) or "overwrite".'
},
{
'name': 'dataset_name',
'help': 'The name of the dataset'
'name': 'dataset_full_path',
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you should use 'flags': 'dataset-full-path'? How about just full-path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we use flags, then what would the default be? or can you make flags required?

@@ -158,26 +127,20 @@ class SolveArgumentParser(argparse.ArgumentParser):
'medium (<500M), large (>=500M)'
},
{
'name': 'dataset_name',
'help': 'The name of the dataset'
'name': 'dataset_full_path',
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

'help': 'The name of the vault to use when '
'creating a new dataset (via --create-dataset), '
'defaults to your personal vault',
},
{
'flags': '--path',
Copy link
Member

Choose a reason for hiding this comment

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

Maybe for consistency with other command line functions, this should also just be --full-path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

im fine with that.

test_cases = [
['{0}:myVault'.format(domain), '{0}:myVault:/'.format(domain)],
['acme:myVault', 'acme:myVault:/'],
['myVault', '{0}:/myVault'.format(user_vault)],
Copy link
Member

Choose a reason for hiding this comment

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

I think we may want to raise an error in this case since it is pretty ambiguous...

Copy link
Member

Choose a reason for hiding this comment

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

['acme:myVault', 'acme:myVault:/'],
['myVault', '{0}:/myVault'.format(user_vault)],
['acme:myVault:/uploads_folder', 'acme:myVault:/uploads_folder'],
['acme:myVault:/uploads_folder', 'acme:myVault:/uploads_folder'],
Copy link
Member

Choose a reason for hiding this comment

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

dupe?

['myVault:/uploads_folder', '{0}:myVault:/uploads_folder'.format(domain)], # noqa
['/uploads_folder', '{0}:/uploads_folder'.format(user_vault)],
[':/uploads_folder', '{0}:/uploads_folder'.format(user_vault)],
['myVault/uploads_folder', '{0}:/myVault/uploads_folder'.format(user_vault)], # noqa
Copy link
Member

Choose a reason for hiding this comment

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

raise error here too? We do that thing where if there is no slash it raises an error.

vault_name = args.vault
else:
vault_name = Vault.get_personal_vault().name
raise Exception(
Copy link
Member

@davecap davecap Jan 2, 2018

Choose a reason for hiding this comment

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

didnt you remove this flag?

else:
vault_name = Vault.get_personal_vault().name
if args.path:
raise Exception(
Copy link
Member

Choose a reason for hiding this comment

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

removed?

#
if args.vault:
raise Exception(
'[Deprecated] --vault has been deprecated. Pass vault path as part of "full_path"' # noqa
Copy link
Member

Choose a reason for hiding this comment

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

remove?

* refactor full path validators with regex
* fix issues with regexes and overrides; use explicit function names
* switch to tilde for personal vault

"""
# FIXME: Does this need to be here? What about other commands?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think remove this?

@jsh2134 jsh2134 merged commit ee76f7d into master Jan 11, 2018
@jsh2134 jsh2134 deleted the f-update-import-shortcuts branch January 11, 2018 17:02
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.

2 participants