Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Cli improvements v0.1 #64

Closed
wants to merge 18 commits into from
Closed

Cli improvements v0.1 #64

wants to merge 18 commits into from

Conversation

miararoy
Copy link
Contributor

@miararoy miararoy commented Oct 8, 2023

Problem

wip

Solution

wip

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Describe specific steps for validating this change.

resin_cli/cli.py Outdated
if not is_healthy(chat_service_url):
msg = (
f"Resin service is not running! on {chat_service_url}"
+ " please run `resin start`"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
+ " please run `resin start`"
" please run `resin start`"

You don't need the + here (in fact - this is a bug! python errors out).

Please remove all +s for multiline strings inside ()

@@ -0,0 +1 @@
__version__ = '0.1.0'
Copy link
Contributor

@igiloh-pinecone igiloh-pinecone Oct 16, 2023

Choose a reason for hiding this comment

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

That's not how do set the version!!!

The version needs to be set in the pyproject.toml file, to be correctly processed by PyPI etc.
You don't need to create duplication.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you need to read the version in the code itself - we should find the proper manner to read it directly from the package (after package was properly installed with pip install, that should be doable).

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the correct solution: https://stackoverflow.com/a/67097076

@@ -78,6 +87,17 @@
]
)

bad_df_metadata_not_allowed_all_permutations = pd.DataFrame(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bad test. It will fail for any of the permutation (the first one), so we won't check that we correctly error out for all cases

resin_cli/cli.py Outdated
Comment on lines 182 to 184
"Error: Failed to connect to Pinecone index, please make sure"
+ " you have set the right env vars"
+ " PINECONE_API_KEY, INDEX_NAME, PINECONE_ENVIRONMENT"
Copy link
Contributor

Choose a reason for hiding this comment

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

This error message is too general and too broad.
We should at least try to catch different type of errors which already have (e.g. RuntimeError), and include some of the original error message.
The KnowledgeBase is already returning meaningful error messages per different failure reason - and we're just throwing that information away

resin_cli/cli.py Outdated
Comment on lines 220 to 223
"Error: Failed to upsert data to index"
+ f" {INDEX_NAME_PREFIX}{index_name}"
+ " this could be due to connection issues"
+ " please re-run `resin upsert`"
Copy link
Contributor

Choose a reason for hiding this comment

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

Again - this is far too general and not actionable. You should use the information in the error raised by KnowledgeBase.
For now this could even be an if on the str(e), at least until we'll have proper error types.

resin_cli/cli.py Outdated
Comment on lines 97 to 99
@click.option("--host", default="0.0.0.0", help="Host")
@click.option("--port", default=8000, help="Port")
@click.option("--ssl/--no-ssl", default=False, help="SSL")
Copy link
Contributor

Choose a reason for hiding this comment

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

You need elaborate, explanative help message for every param of every command, not just the commands themselves

Since the package is installed, we can read the right version using `importlib
A. Changed is_healthy to simply exit, instead of being a bool - saves a lot of code duplication
B. Distinguish between the case of service not running to service is running but unhealthy
Give more detailed indication of the actual underlying problem.
Made them a bit more explicit.
@igiloh-pinecone
Copy link
Contributor

Closing the PR, and opening a new one as author (from the same branch)

@igiloh-pinecone igiloh-pinecone deleted the cli-improvements-v0.1 branch October 19, 2023 15:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants