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

fix: Add fix and test for 'triton' with no args #89

Merged
merged 2 commits into from
Oct 31, 2024
Merged

Conversation

rmccorm4
Copy link
Collaborator

Before:

$ triton
triton - ERROR - list index out of range
triton - ERROR - Unexpected error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/triton_cli/main.py", line 51, in main
    run()
  File "/usr/local/lib/python3.10/dist-packages/triton_cli/main.py", line 44, in run
    args = parser.parse_args(argv)
  File "/usr/local/lib/python3.10/dist-packages/triton_cli/parser.py", line 447, in parse_args
    if argv_[0] == "profile":
IndexError: list index out of range

After:

$ triton
usage: triton [-h] [-v] {import,remove,list,start,infer,profile,metrics,config,status} ...
triton: error: the following arguments are required: {import,remove,list,start,infer,profile,metrics,config,status}

Copy link
Contributor

@KrishnanPrash KrishnanPrash left a comment

Choose a reason for hiding this comment

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

I have a general workflow question:
Do we want to error out for someone using the triton command without any args? What are the cons of something like this?

/opt/tritonserver# triton
usage: triton [-h] [-v]
              {import,remove,list,start,infer,profile,metrics,config,status} ...
triton: For further information, ex: triton import -h
/opt/tritonserver# echo $?
0

@rmccorm4
Copy link
Collaborator Author

Can you clarify the question? Are you asking if we care whether the return code is 0 or 2 for running triton with no args? If so, I don't think it's a big deal either way as long as the help message is output to the screen. I defaulted to letting argparse use its default behavior, which happened to be return code 2. It's a sign to the user they're doing something wrong and need an arg, but a convenience for people too lazy to type -h/--help

@KrishnanPrash
Copy link
Contributor

Can you clarify the question? Are you asking if we care whether the return code is 0 or 2 for running triton with no args? If so, I don't think it's a big deal either way as long as the help message is output to the screen. I defaulted to letting argparse use its default behavior, which happened to be return code 2. It's a sign to the user they're doing something wrong and need an arg, but a convenience for people too lazy to type -h/--help

Yup, I was primarily wondering if we want to consider the no args command triton an error and depending on that if we want to provide return code of 0 or 2.

Copy link
Contributor

@KrishnanPrash KrishnanPrash left a comment

Choose a reason for hiding this comment

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

Overall looks good to me! With this the error message should be much more helpful than the previous unrelated profile error.

@rmccorm4 rmccorm4 merged commit 6603dd7 into main Oct 31, 2024
4 checks passed
@rmccorm4 rmccorm4 deleted the rmccormick/no-args branch October 31, 2024 23:52
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