Skip to content

Conversation

ebr
Copy link
Member

@ebr ebr commented Aug 9, 2023

Currently, when unknown CLI arguments are encountered, argparse exits with an error.

This PR changes that so that unknown CLI args are silently ignored. Particularly this enables running the uvicorn server directly, taking advantage of hot-reloading in development, like so: uvicorn invokeai.app.api_app:app --reload.

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

Have you discussed this change with the InvokeAI team?

  • Yes
  • No, because:

Have you updated all relevant documentation?

  • Yes
  • No (will update the docs if this direction is deemed acceptable)

Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

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

It works, but I'd like to hear some more commentary on this from other team members.

I'd thought of doing this a while ago, but then I realized that this would no longer catch typos in the command line arguments. For example, someone types:
invokeai-web --db-dir /foo/bar/invokeai.db

The command works, but why isn't it picking up the correct database? Oh, because the correct switch is: --db_dir, not --db-dir.

Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

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

Can we get a print of unknown args so I don't go crazy trying to figure out why my --prot 9091 didn't work?

psychedelicious added a commit that referenced this pull request Sep 8, 2023
Do not throw when parsing unknown args, instead parse only known args print the unknown ones (supersedes #4216)
@psychedelicious psychedelicious mentioned this pull request Sep 8, 2023
8 tasks
@ebr ebr closed this Sep 8, 2023
hipsterusername pushed a commit that referenced this pull request Sep 8, 2023
Do not throw when parsing unknown args, instead parse only known args print the unknown ones (supersedes #4216)
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.

3 participants