From 8e5c25e46a28de4f69dfd8281477c9bbb4e7416e Mon Sep 17 00:00:00 2001 From: Brian Wylie Date: Fri, 2 Feb 2024 09:08:56 -0700 Subject: [PATCH] changing hey to help --- .../sageworks_core/sageworks_core_stack.py | 2 +- src/sageworks/repl/sageworks_shell.py | 23 ++++++++++++++----- src/sageworks/utils/config_manager.py | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/aws_setup/sageworks_core/sageworks_core/sageworks_core_stack.py b/aws_setup/sageworks_core/sageworks_core/sageworks_core_stack.py index 683d08617..338cc4af8 100644 --- a/aws_setup/sageworks_core/sageworks_core/sageworks_core_stack.py +++ b/aws_setup/sageworks_core/sageworks_core/sageworks_core_stack.py @@ -75,7 +75,7 @@ def create_sageworks_api_policy(self) -> iam.ManagedPolicy: "athena:GetQueryResults", # To fetch query results "athena:StopQueryExecution", # To stop query executions, if needed "athena:GetWorkGroup", # To get workgroup details - "athena:ListWorkGroups" # To list available workgroups + "athena:ListWorkGroups", # To list available workgroups ], resources=["*"], ), diff --git a/src/sageworks/repl/sageworks_shell.py b/src/sageworks/repl/sageworks_shell.py index b1b8a0922..64293427e 100644 --- a/src/sageworks/repl/sageworks_shell.py +++ b/src/sageworks/repl/sageworks_shell.py @@ -80,7 +80,7 @@ def __init__(self): self.shell = InteractiveShellEmbed(config=config, banner1="", exit_msg="Goodbye from SageWorks!") # Register our custom commands - self.commands["hey"] = self.hey + self.commands["help"] = self.help self.commands["docs"] = self.doc_browser self.commands["summary"] = self.summary self.commands["incoming_data"] = self.incoming_data @@ -105,7 +105,7 @@ def start(self): cprint("red", f"Path: {self.cm.site_config_path}") self.show_config() else: - self.hey() + self.help() self.summary() # Start the REPL @@ -204,10 +204,24 @@ def import_sageworks(self): self.commands["pd"] = importlib.import_module("pandas") self.commands["pprint"] = importlib.import_module("pprint").pprint + def help(self, *args): + """Custom help command for the SageWorks REPL + + Args: + *args: Arguments passed to the help command. + """ + # If we have args forward to the built-in help function + if args: + help(*args) + + # Otherwise show the SageWorks help message + else: + cprint("lightblue", self.help_txt()) + @staticmethod def help_txt(): help_msg = """ Commands: - - hey: Show this help message + - help: Show this help message - docs: Open browser to show SageWorks Documentation - summary: Show a summary of all the AWS Artifacts - incoming_data: List all the incoming S3 data @@ -222,9 +236,6 @@ def help_txt(): - exit: Exit SageWorks REPL""" return help_msg - def hey(self): - cprint("lightblue", self.help_txt()) - @staticmethod def doc_browser(): """Open a browser and start the Dash app and open a browser.""" diff --git a/src/sageworks/utils/config_manager.py b/src/sageworks/utils/config_manager.py index c86513d9b..feb98cffc 100644 --- a/src/sageworks/utils/config_manager.py +++ b/src/sageworks/utils/config_manager.py @@ -397,6 +397,7 @@ def _load_default_config(self) -> Dict[str, Any]: # Simulate running on Docker def running_on_docker() -> bool: # noqa: F811 return True + ConfigManager._instance = None # We need to reset the singleton instance for testing os.environ.pop("SAGEWORKS_BUCKET", None) cm = ConfigManager()