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

Support multiple workload deletion from single workload delete command #62

Merged
merged 7 commits into from
Feb 6, 2024

Conversation

SurbhiJainUSC
Copy link
Collaborator

Fixes / Features

  • Support deletion of all workloads in the cluster
  • Support deletion of workloads filtering by job name in the cluster

Testing / Documentation

Testing details.

  • [ y ] Tests pass
  • [ y ] Appropriate changes to documentation are included in the PR

Copy link
Collaborator

@Obliviour Obliviour left a comment

Choose a reason for hiding this comment

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

Looks great! I already heard of a customer interested in using this feature so this will be eagerly used!

xpk.py Outdated
xpk_print("There are no workloads to delete matching the filter in the cluster.")

for workload in workloads:
result = input(f'Do you want to delete the workload: {workload} (Y/n)? ')
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the yes / no user feedback logic here! two suggestions:

  1. Can the user enter yes/no/y/n once per workload delete command, instead of once per workload. We can print out all the workloads that are planned to be deleted. (Same as https://github.com/google/xpk/blob/main/xpk.py#L1396-L1401)

I think it would be hard to ask the user to type yes several times.

  1. Can you refactor the user input y/yes/n/no logic we use in node pool delete into a function and use that here as well. I think we will also need it in cluster deletion as well for a new feature request. (https://github.com/google/xpk/blob/main/xpk.py#L1396-L1401)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated!

xpk.py Outdated
)

### Optional arguments
workload_delete_parser_optional_arguments.add_argument(
'--workload',
type=workload_name_type,
default=None,
help='The name of the workload to delete.',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add that if the workload is not specified, the default behavior is that all workloads will be deleted from the cluster?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added!

README.md Outdated
--cluster xpk-test
```

This will delete all the workloads in `xpk-test` cluster. Deletion will only begin if you type `Y` at the prompt for every workload.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: to adjust the readme that users only need to type yes/y once at the prompt.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

required=True,
)

### Optional arguments
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a --force argument that skips the user prompt? This is good for automated tests for example. Or if a user really believes in themselves. You can build from https://github.com/google/xpk/blob/main/xpk.py#L2823-L2830

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, added!

xpk.py Show resolved Hide resolved
xpk.py Show resolved Hide resolved
Copy link
Collaborator

@Obliviour Obliviour left a comment

Choose a reason for hiding this comment

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

LGTM, great set of changes! Thank you

@SurbhiJainUSC SurbhiJainUSC merged commit 4c21926 into main Feb 6, 2024
3 checks passed
@SurbhiJainUSC SurbhiJainUSC deleted the delete_workload branch February 6, 2024 00:49
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