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: PLAT-1152 / add data studios 'list' command #475

Merged
merged 16 commits into from
Jan 16, 2025

Conversation

georgi-seqera
Copy link
Contributor

@georgi-seqera georgi-seqera commented Jan 15, 2025

Context
Adding new commands for interacting with data studios: https://seqera.atlassian.net/browse/PLAT-583

This PR includes changes on top of this related PR: #474

Testing

Get all data studios for a workspace:

% ./tw --insecure studios list -w 232522928652345
Running in Zsh

  Data Studios at [doofenshmirtz-evil-inc / perry] workspace:

     ID       | Name        | Description | User           | Status
    ----------+-------------+-------------+----------------+---------
     a69429ba | studio-faad | Test2       | georgi-hristov | RUNNING
     c779bf09 | studio-d456 | Test3       | georgi-hristov | RUNNING
     ddfd5e14 | studio-7728 |             | georgi-hristov | STOPPED

Get list for workspace with pagination options supplied:

% ./tw --insecure studios list -w 232522928652345 --page 1 --max 2

  Data Studios at [doofenshmirtz-evil-inc / perry] workspace:

     ID       | Name        | Description | User           | Status
    ----------+-------------+-------------+----------------+---------
     a69429ba | studio-faad | Test2       | georgi-hristov | RUNNING
     ddfd5e14 | studio-7728 |             | georgi-hristov | STOPPED

  Page 1, showing from 0 to 1 from a total of 3 entries.

% ./tw --insecure studios list -w 232522928652345 --page 2 --max 2

  Data Studios at [doofenshmirtz-evil-inc / perry] workspace:

     ID       | Name        | Description | User           | Status
    ----------+-------------+-------------+----------------+---------
     c779bf09 | studio-d456 | Test3       | georgi-hristov | RUNNING

  Page 2, showing from 2 to 3 from a total of 3 entries.

% ./tw --insecure studios list -w 232522928652345 --offset 1 --max 2

  Data Studios at [doofenshmirtz-evil-inc / perry] workspace:

     ID       | Name        | Description | User           | Status
    ----------+-------------+-------------+----------------+---------
     a69429ba | studio-faad | Test2       | georgi-hristov | RUNNING
     c779bf09 | studio-d456 | Test3       | georgi-hristov | RUNNING

  Showing from 1 to 2 from a total of 3 entries.

Get list for workspace with filter based on freetext or keyword search supplied:

% ./tw --insecure studios list -w 232522928652345 --filter status:stopped
Running in Zsh

  Data Studios at [doofenshmirtz-evil-inc / perry] workspace:

     ID       | Name        | Description | User           | Status
    ----------+-------------+-------------+----------------+---------
     ddfd5e14 | studio-7728 |             | georgi-hristov | STOPPED

import picocli.CommandLine;

@CommandLine.Command(
name = "studios", // alternative "data-studio"
Copy link
Contributor

Choose a reason for hiding this comment

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

The rule is to follow the API, as we use studios in API this is correct, no need for data-studios

Copy link
Contributor

Choose a reason for hiding this comment

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

btw. you can remove that comment then if everyone agrees

Copy link
Member

@endre-seqera endre-seqera left a comment

Choose a reason for hiding this comment

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

Nice one! To me it looks goods. The only minor change I would do is to handle both error codes (404,403) in the list and view commands as Weronika mentioned.

I also think we can close the other PR, which only contains the view command in favor of this one, and merging these two commands in this PR.

Copy link
Contributor

@weronikasosnowskaseqera weronikasosnowskaseqera left a comment

Choose a reason for hiding this comment

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

LGTM, left some minor comments. Nice job!

}
if (e.getCode() == 403) {
throw new TowerException(String.format("User not entitled to %s workspace", wspId));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You missed throw e; here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch - thanks!

import picocli.CommandLine;

@CommandLine.Command(
name = "studios", // alternative "data-studio"
Copy link
Contributor

Choose a reason for hiding this comment

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

btw. you can remove that comment then if everyone agrees

@georgi-seqera georgi-seqera merged commit bcb3d9d into master Jan 16, 2025
7 checks passed
@georgi-seqera georgi-seqera deleted the PLAT-1152/add-studios-commands-list branch January 16, 2025 11:36
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