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

[Feature][kubectl-plugin] return usage error when no entrypoint input #2503

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chiayi
Copy link
Contributor

@chiayi chiayi commented Nov 6, 2024

Why are these changes needed?

Check for ray job submit entrypoint input from user.

Currently if there is no "--", it will cause error with panic: runtime error: slice bounds out of range [-1:].
Or if there is no entrypoint input after "--", the command will run through the whole cluster setup process and job submission step and then fail. Adding a check will ensure that it won't need to go through the whole setup/submission process.

Related issue number

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@@ -104,6 +104,12 @@ func NewJobSubmitCommand(streams genericclioptions.IOStreams) *cobra.Command {
Example: jobSubmitExample,
RunE: func(cmd *cobra.Command, args []string) error {
entryPointStart := cmd.ArgsLenAtDash()
if entryPointStart == -1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if entryPointStart == -1 || len(args[entryPointStart:]) == 0 {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can cmd.ArgsLenAtDash return -1? If so what does it mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cmd.ArgsLenAtDash returning -1 just means that there isn't a "--"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ex:
Screenshot 2024-11-05 at 6 03 44 PM

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