-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dashboard command for debugging ragulate (#587)
- Loading branch information
Showing
6 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from ragstack_ragulate.dashboard import run_dashboard | ||
|
||
from .utils import remove_sqlite_extension | ||
|
||
|
||
def setup_dashboard(subparsers): | ||
"""Setup the dashboard command.""" | ||
dashboard_parser = subparsers.add_parser( | ||
"dashboard", | ||
help="Show the tru-lens dashboard for a recipe. Can be helpful for debugging.", | ||
) | ||
dashboard_parser.add_argument( | ||
"-r", | ||
"--recipe", | ||
type=str, | ||
help="A recipe to see the dashboard for.", | ||
required=True, | ||
) | ||
dashboard_parser.add_argument( | ||
"-p", | ||
"--port", | ||
type=int, | ||
help="Port to show the dashboard on, default 8501", | ||
default=8501, | ||
) | ||
dashboard_parser.set_defaults(func=lambda args: call_dashboard(**vars(args))) | ||
|
||
|
||
def call_dashboard( | ||
recipe: str, | ||
port: int, | ||
**_, | ||
): | ||
"""Runs the TruLens dashboard.""" | ||
recipe_name = remove_sqlite_extension(recipe) | ||
run_dashboard(recipe_name=recipe_name, port=port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def remove_sqlite_extension(s): | ||
"""Remove the .sqlite extension from a string.""" | ||
if s.endswith(".sqlite"): | ||
return s[:-7] | ||
return s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from typing import Optional | ||
|
||
from .utils import get_tru | ||
|
||
|
||
def run_dashboard(recipe_name: str, port: Optional[int] = 8501): | ||
"""Runs the TruLens dashboard.""" | ||
tru = get_tru(recipe_name=recipe_name) | ||
tru.run_dashboard(port=port) |