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

DATA-3399: Dataset Data Remove Functions #4780

Merged
merged 7 commits into from
Feb 11, 2025

Conversation

vpandiarajan20
Copy link
Member

@vpandiarajan20 vpandiarajan20 commented Feb 6, 2025

  • Renames dataset data remove to dataset data remove ids
  • Creates new command dataset data remove filter

Manually tested:
viam dataset data add ids --dataset-id=67a512205da1bc26ca01cd5a --location-id=nihu6z0k8c --org-id=0fbe951e-d4c6-427f-985f-784b7b85842c --file-ids=rXu0LkivJtEZojTkmO86xdy5Ft3QovKQfYo17a6EsCNhgCPngHGgab9zj6jCpwLK,9kw4DyE5qxYai0c86xzXXyQNnpN2K26FKT3UzM68WdwmhB4zNValb4bSKkvl7b5V

Screenshot 2025-02-06 at 3 59 42 PM

viam dataset data remove filter --dataset-id=67a512205da1bc26ca01cd5a --location-ids=nihu6z0k8c --start=2023-01-01T05:00:00.000Z --end=2024-10-01T04:00:00.000Z --tags=blue_star
Screenshot 2025-02-06 at 3 56 20 PM

  • Both commands correctly add and remove images from dataset

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Feb 6, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 6, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 6, 2025
@vpandiarajan20 vpandiarajan20 marked this pull request as ready for review February 6, 2025 21:03
@vpandiarajan20 vpandiarajan20 requested a review from a team as a code owner February 6, 2025 21:03
Copy link
Member

@purplenicole730 purplenicole730 left a comment

Choose a reason for hiding this comment

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

A few wording things, but otherwise, LGTM

cli/app.go Outdated
&cli.StringSliceFlag{
Name: generalFlagTags,
Usage: "tags filter. " +
"accepts tagged for all tagged data, untagged for all untagged data, or a list of tags for all data matching any of the tags",
Copy link
Member

Choose a reason for hiding this comment

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

I was a little confused by this usage text. If I'm understanding this correctly, then tagged and untagged are string values you can pass into this argument? If so, I would wrap them in single ' quotes.

cli/app.go Outdated
Required: true,
{
Name: "filter",
Usage: "removes binary data from the specified filter from dataset",
Copy link
Member

Choose a reason for hiding this comment

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

I would word this differently since it sounds like the data is being removed from the filter.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe "removes binary data associated with a filter from a dataset"? And then for IDs "removes binary data with specified IDs from a dataset"

Copy link
Member

@stuqdog stuqdog left a comment

Choose a reason for hiding this comment

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

lgtm % Nicole's comments!

Copy link
Member

@tahiyasalam tahiyasalam left a comment

Choose a reason for hiding this comment

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

Looks good! No need to block on my re-review

cli/app.go Outdated
Required: true,
{
Name: "filter",
Usage: "removes binary data from the specified filter from dataset",
Copy link
Member

Choose a reason for hiding this comment

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

Maybe "removes binary data associated with a filter from a dataset"? And then for IDs "removes binary data with specified IDs from a dataset"

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 11, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 11, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 11, 2025
cli/data.go Outdated
@@ -1025,7 +1025,7 @@ type dataRemoveFromDatasetArgs struct {
FileIDs []string
}

// DataRemoveFromDataset is the corresponding action for 'data dataset remove'.
// DataRemoveFromDataset is the corresponding action for 'data dataset remove ids'.
Copy link
Member

Choose a reason for hiding this comment

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

Should this be dataset data remove?

cli/data.go Outdated
DatasetID string
}

// DataRemoveFromDatasetByFilter is the corresponding action for 'data dataset remove filter'.
Copy link
Member

Choose a reason for hiding this comment

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

dataset data remove?

},
},
commonFilterFlags...),
Action: createCommandWithT[dataAddToDatasetByFilterArgs](DataAddToDatasetByFilter),
},
},
},
//nolint:dupl
Copy link
Member

Choose a reason for hiding this comment

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

What exactly is the nolint referring to since the usage text for add / remove is different?

Copy link
Member Author

Choose a reason for hiding this comment

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

cli/app.go:1417: 1417-1474 lines are duplicate of `cli/app.go:1475-1532` (dupl)
                                                {
                                                        Name:            "add",
                                                        Usage:           "adds binary data either by IDs or filter to dataset",
                                                        UsageText:       createUsageText("dataset data add", nil, false, true),
                                                        HideHelpCommand: true,
                                                        Subcommands: []*cli.Command{
                                                                {
                                                                        Name:  "ids",
                                                                        Usage: "adds binary data with file IDs in a single org and location to dataset",
                                                                        UsageText: createUsageText(
                                                                                "dataset data add ids", []string{datasetFlagDatasetID, generalFlagOrgID, dataFlagLocationID, dataFlagFileIDs}, false, false,
                                                                        ),
                                                                        Flags: []cli.Flag{
                                                                                &cli.StringFlag{
                                                                                        Name:     datasetFlagDatasetID,
                                                                                        Usage:    "dataset ID to which data will be added",
                                                                                        Required: true,
                                                                                },
                                                                                &cli.StringFlag{
                                                                                        Name:     generalFlagOrgID,
                                                                                        Usage:    "org ID to which data belongs",
                                                                                        Required: true,
                                                                                },
                                                                                &cli.StringFlag{
                                                                                        Name:     dataFlagLocationID,
                                                                                        Usage:    "location ID to which data belongs",
                                                                                        Required: true,
                                                                                },
                                                                                &cli.StringSliceFlag{
                                                                                        Name:     dataFlagFileIDs,
                                                                                        Usage:    "file IDs of data belonging to specified org and location",
                                                                                        Required: true,
                                                                                },
                                                                        },
                                                                        Action: createCommandWithT[dataAddToDatasetByIDsArgs](DataAddToDatasetByIDs),
                                                                },
                                                                {
                                                                        Name:      "filter",
                                                                        Usage:     "adds binary data associated with a filter to a dataset",
                                                                        UsageText: createUsageText("dataset data add filter", []string{datasetFlagDatasetID}, true, false),
                                                                        Flags: append([]cli.Flag{
                                                                                &cli.StringFlag{
                                                                                        Name:     datasetFlagDatasetID,
                                                                                        Usage:    "dataset ID to which data will be added",
                                                                                        Required: true,
                                                                                },
                                                                                &cli.StringSliceFlag{
                                                                                        Name: generalFlagTags,
                                                                                        Usage: "tags filter. " +
                                                                                                "accepts 'tagged' for all tagged data, 'untagged' for all untagged data, " +
                                                                                                "or a list of tags for all data matching any of the tags",
                                                                                },
                                                                        },
                                                                                commonFilterFlags...),
                                                                        Action: createCommandWithT[dataAddToDatasetByFilterArgs](DataAddToDatasetByFilter),
                                                                },
                                                        },
                                                },
cli/app.go:1475: 1475-1532 lines are duplicate of `cli/app.go:1417-1474` (dupl)
                                                {
                                                        Name:            "remove",
                                                        Usage:           "removes binary data either by IDs or filter from dataset",
                                                        UsageText:       createUsageText("dataset data remove", nil, false, true),
                                                        HideHelpCommand: true,
                                                        Subcommands: []*cli.Command{
                                                                {
                                                                        Name:  "ids",
                                                                        Usage: "removes binary data with file IDs in a single org and location from a dataset",
                                                                        UsageText: createUsageText(
                                                                                "dataset data remove ids", []string{datasetFlagDatasetID, generalFlagOrgID, dataFlagLocationID, dataFlagFileIDs}, false, false,
                                                                        ),
                                                                        Flags: []cli.Flag{
                                                                                &cli.StringFlag{
                                                                                        Name:     datasetFlagDatasetID,
                                                                                        Usage:    "dataset ID from which data will be removed",
                                                                                        Required: true,
                                                                                },
                                                                                &cli.StringFlag{
                                                                                        Name:     generalFlagOrgID,
                                                                                        Usage:    "org ID to which data belongs",
                                                                                        Required: true,
                                                                                },
                                                                                &cli.StringFlag{
                                                                                        Name:     dataFlagLocationID,
                                                                                        Usage:    "location ID to which data belongs",
                                                                                        Required: true,
                                                                                },
                                                                                &cli.StringSliceFlag{
                                                                                        Name:     dataFlagFileIDs,
                                                                                        Usage:    "file IDs of data belonging to specified org and location",
                                                                                        Required: true,
                                                                                },
                                                                        },
                                                                        Action: createCommandWithT[dataRemoveFromDatasetArgs](DataRemoveFromDataset),
                                                                },
                                                                {
                                                                        Name:      "filter",
                                                                        Usage:     "removes binary data associated with a filter from a dataset",
                                                                        UsageText: createUsageText("dataset data remove filter", []string{datasetFlagDatasetID}, true, false),
                                                                        Flags: append([]cli.Flag{
                                                                                &cli.StringFlag{
                                                                                        Name:     datasetFlagDatasetID,
                                                                                        Usage:    "dataset ID from which data will be removed",
                                                                                        Required: true,
                                                                                },
                                                                                &cli.StringSliceFlag{
                                                                                        Name: generalFlagTags,
                                                                                        Usage: "tags filter. " +
                                                                                                "accepts 'tagged' for all tagged data, 'untagged' for all untagged data, " +
                                                                                                "or a list of tags for all data matching any of the tags",
                                                                                },
                                                                        },
                                                                                commonFilterFlags...),
                                                                        Action: createCommandWithT[dataRemoveFromDatasetByFilterArgs](DataRemoveFromDatasetByFilter),
                                                                },
                                                        },
                                                },

I think there's some sort of tolerance built in where it recognizes it as duplicate if only a few characters are changed. Not entirely sure though.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 11, 2025
@vpandiarajan20 vpandiarajan20 merged commit 17ecf94 into viamrobotics:main Feb 11, 2025
16 checks passed
vijayvuyyuru pushed a commit to vijayvuyyuru/rdk that referenced this pull request Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants