File tree Expand file tree Collapse file tree 6 files changed +55
-7
lines changed
libs/ragulate/ragstack_ragulate Expand file tree Collapse file tree 6 files changed +55
-7
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ def main() -> None:
25
25
cli_commands .setup_query (subparsers = subparsers )
26
26
cli_commands .setup_compare (subparsers = subparsers )
27
27
cli_commands .setup_run (subparsers = subparsers )
28
+ cli_commands .setup_dashboard (subparsers = subparsers )
28
29
29
30
# Parse the command-line arguments
30
31
args = parser .parse_args ()
Original file line number Diff line number Diff line change 1
1
from .compare import setup_compare
2
+ from .dashboard import setup_dashboard
2
3
from .download import setup_download
3
4
from .ingest import setup_ingest
4
5
from .query import setup_query
5
6
from .run import setup_run
6
7
7
8
__all__ = [
8
9
"setup_compare" ,
10
+ "setup_dashboard" ,
9
11
"setup_download" ,
10
12
"setup_ingest" ,
11
13
"setup_query" ,
Original file line number Diff line number Diff line change 2
2
3
3
from ragstack_ragulate .analysis import Analysis
4
4
5
+ from .utils import remove_sqlite_extension
6
+
5
7
6
8
def setup_compare (subparsers ):
7
9
"""Setup the compare command."""
@@ -26,13 +28,6 @@ def setup_compare(subparsers):
26
28
compare_parser .set_defaults (func = lambda args : call_compare (** vars (args )))
27
29
28
30
29
- def remove_sqlite_extension (s ):
30
- """Remove the .sqlite extension from a string."""
31
- if s .endswith (".sqlite" ):
32
- return s [:- 7 ]
33
- return s
34
-
35
-
36
31
def call_compare (
37
32
recipe : List [str ],
38
33
output : Optional [str ] = "box-plots" ,
Original file line number Diff line number Diff line change
1
+ from ragstack_ragulate .dashboard import run_dashboard
2
+
3
+ from .utils import remove_sqlite_extension
4
+
5
+
6
+ def setup_dashboard (subparsers ):
7
+ """Setup the dashboard command."""
8
+ dashboard_parser = subparsers .add_parser (
9
+ "dashboard" ,
10
+ help = "Show the tru-lens dashboard for a recipe. Can be helpful for debugging." ,
11
+ )
12
+ dashboard_parser .add_argument (
13
+ "-r" ,
14
+ "--recipe" ,
15
+ type = str ,
16
+ help = "A recipe to see the dashboard for." ,
17
+ required = True ,
18
+ )
19
+ dashboard_parser .add_argument (
20
+ "-p" ,
21
+ "--port" ,
22
+ type = int ,
23
+ help = "Port to show the dashboard on, default 8501" ,
24
+ default = 8501 ,
25
+ )
26
+ dashboard_parser .set_defaults (func = lambda args : call_dashboard (** vars (args )))
27
+
28
+
29
+ def call_dashboard (
30
+ recipe : str ,
31
+ port : int ,
32
+ ** _ ,
33
+ ):
34
+ """Runs the TruLens dashboard."""
35
+ recipe_name = remove_sqlite_extension (recipe )
36
+ run_dashboard (recipe_name = recipe_name , port = port )
Original file line number Diff line number Diff line change
1
+ def remove_sqlite_extension (s ):
2
+ """Remove the .sqlite extension from a string."""
3
+ if s .endswith (".sqlite" ):
4
+ return s [:- 7 ]
5
+ return s
Original file line number Diff line number Diff line change
1
+ from typing import Optional
2
+
3
+ from .utils import get_tru
4
+
5
+
6
+ def run_dashboard (recipe_name : str , port : Optional [int ] = 8501 ):
7
+ """Runs the TruLens dashboard."""
8
+ tru = get_tru (recipe_name = recipe_name )
9
+ tru .run_dashboard (port = port )
You can’t perform that action at this time.
0 commit comments