From f136f5835ca14d510615574b910e7f4169feea80 Mon Sep 17 00:00:00 2001 From: Umar Farooq Ghumman Date: Wed, 24 Apr 2024 08:32:02 -0500 Subject: [PATCH] Log Format Update - Brought page names ahead --- project/ui/qprof-ui.ipynb | 30 +++++++++++++++--------------- project/ui/qprof_main.ipynb | 26 +++++++++++++------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/project/ui/qprof-ui.ipynb b/project/ui/qprof-ui.ipynb index 7c291429..18356f6f 100644 --- a/project/ui/qprof-ui.ipynb +++ b/project/ui/qprof-ui.ipynb @@ -20,11 +20,11 @@ }, "outputs": [], "source": [ - "logging.info('Importing Libraries [Query Profile Tree Page]')\n", + "logging.info('[Query Profile Tree Page] Importing Libraries')\n", "import pickle\n", "import ipywidgets as widgets\n", "from verticapy.performance.vertica import QueryProfilerInterface, QueryProfiler\n", - "logging.info('Successfully Imported Libraries [Query Profile Tree Page]')\n", + "logging.info('[Query Profile Tree Page] Successfully Imported Libraries ')\n", "output_initial = widgets.Output()\n", "with output_initial:\n", " %store -r query_val\n", @@ -38,39 +38,39 @@ " %store -r transaction_statement_list_val\n", "\n", " if \"file_val\" in globals():\n", - " logging.info(f'Importing profile using target_schema as {target_schema_val}, key_id as {key_val}, filename as{file_val}, [Query Profile Tree Page]')\n", + " logging.info(f'[Query Profile Tree Page] Importing profile using target_schema as {target_schema_val}, key_id as {key_val}, filename as{file_val}')\n", " qprof = QueryProfiler.import_profile(target_schema=target_schema_val,\n", " key_id=key_val,\n", " filename=file_val,\n", " auto_initialize = False \n", " )\n", - " logging.info(f'Creating qprof object using target_schema as {target_schema_val}, key_id as {key_val if \"key_val\" in globals() else None}., [Query Profile Tree Page]')\n", + " logging.info(f'[Query Profile Tree Page] Creating qprof object using target_schema as {target_schema_val}, key_id as {key_val if \"key_val\" in globals() else None}.')\n", " qprof = QueryProfilerInterface(\n", " target_schema = target_schema_val,\n", " key_id = key_val if \"key_val\" in globals() else None,\n", " )\n", " elif \"target_schema_val\" in globals():\n", - " logging.info(f'Creating qprof object using target_schema as {target_schema_val}, key_id as {key_val}. [Query Profile Tree Page]')\n", + " logging.info(f'[Query Profile Tree Page] Creating qprof object using target_schema as {target_schema_val}, key_id as {key_val}. [Query Profile Tree Page]')\n", " qprof = QueryProfilerInterface(\n", " target_schema = target_schema_val,\n", " key_id = key_val,\n", " )\n", " elif \"query_val\" in globals():\n", - " logging.info(f'Creating qprof object using query as \"{query_val}\" target_schema as {target_schema_val_2 if \"target_schema_val_2\" in globals() else None}, key_id as {key_val_2 if \"key_val_2\" in globals() else None}. [Query Profile Tree Page]')\n", + " logging.info(f'[Query Profile Tree Page] Creating qprof object using query as \"{query_val}\" target_schema as {target_schema_val_2 if \"target_schema_val_2\" in globals() else None}, key_id as {key_val_2 if \"key_val_2\" in globals() else None}')\n", " qprof = QueryProfilerInterface(\n", " query_val,\n", " target_schema = target_schema_val_2 if \"target_schema_val_2\" in globals() else None,\n", " key_id = key_val_2 if \"key_val_2\" in globals() else None, \n", " )\n", " elif \"transaction_val\" in globals():\n", - " logging.info(f'Creating qprof object using transactions as {eval(transaction_val), eval(statement_val)}, target_schema as {target_schema_val_2 if \"target_schema_val_2\" in globals() else None}, key_id as{key_val_2 if \"key_val_2\" in globals() else None}, [Query Profile Tree Page]')\n", + " logging.info(f'[Query Profile Tree Page] Creating qprof object using transactions as {eval(transaction_val), eval(statement_val)}, target_schema as {target_schema_val_2 if \"target_schema_val_2\" in globals() else None}, key_id as{key_val_2 if \"key_val_2\" in globals() else None}')\n", " qprof = QueryProfilerInterface(\n", " transactions = (eval(transaction_val), eval(statement_val)),\n", " target_schema = target_schema_val_2 if \"target_schema_val_2\" in globals() else None,\n", " key_id = key_val_2 if \"key_val_2\" in globals() else None,\n", " )\n", " elif \"transaction_statement_list_val\" in globals():\n", - " logging.info(f'Creating qprof object using transactions as {eval(transaction_statement_list_val)}, target_schema as {target_schema_val_2 if \"target_schema_val_2\" in globals() else None}, key_id as{key_val_2 if \"key_val_2\" in globals() else None}, [Query Profile Tree Page]')\n", + " logging.info(f'[Query Profile Tree Page] Creating qprof object using transactions as {eval(transaction_statement_list_val)}, target_schema as {target_schema_val_2 if \"target_schema_val_2\" in globals() else None}, key_id as{key_val_2 if \"key_val_2\" in globals() else None}')\n", " qprof = QueryProfilerInterface(\n", " transactions = eval(transaction_statement_list_val),\n", " target_schema = target_schema_val_2 if \"target_schema_val_2\" in globals() else None,\n", @@ -119,7 +119,7 @@ "\n", "\n", "def trigger_download(data, filename, file_type='application/octet-stream'):\n", - " logging.info(f'Trying to download file [Query Profile Tree Page]')\n", + " logging.info(f'[Query Profile Tree Page] Trying to download file')\n", " content_b64 = b64encode(data).decode()\n", " data_url = f'data:{file_type};base64,{content_b64}'\n", " js_code = f\"\"\"\n", @@ -168,7 +168,7 @@ "metadata": {}, "outputs": [], "source": [ - "logging.info(f'Trying to display the back and \"save query plan\" button')\n", + "logging.info(f'[Query Profile Tree Page] Trying to display the back and \"save query plan\" button')\n", "display(widgets.HBox([html_button1,button_qprof_save]))\n", "display(output_export)" ] @@ -180,7 +180,7 @@ "metadata": {}, "outputs": [], "source": [ - "logging.info(f'Running the script to automatically display the tree [Query Profile Tree Page]')\n", + "logging.info(f'[Query Profile Tree Page] Running the script to automatically display the tree')\n", "from IPython.display import display,clear_output, IFrame, HTML\n", "html_code = '''\n", "\n", @@ -208,7 +208,7 @@ "outputs": [], "source": [ "display(HTML(html_code))\n", - "logging.info(f'Completed the script to automatically display the tree [Query Profile Tree Page]')" + "logging.info(f'[Query Profile Tree Page] Completed the script to automatically display the tree')" ] }, { @@ -221,9 +221,9 @@ "output_tree = widgets.Output()\n", "\n", "with output_tree:\n", - " logging.info(f'Trying to display the tree')\n", + " logging.info(f'[Query Profile Tree Page] Trying to display the tree')\n", " qprof.get_qplan_tree()\n", - " logging.info(f'Finished trying to display the tree')\n", + " logging.info(f'[Query Profile Tree Page] Finished trying to display the tree')\n", "display(output_tree)" ] }, @@ -235,7 +235,7 @@ "outputs": [], "source": [ "accordion = widgets.Accordion(children=[output_initial], titles=('Execution/Error Details',))\n", - "logging.info(f'Trying to display the error log at the bottom of the page [Query Profile Tree Page]')\n", + "logging.info(f'[Query Profile Tree Page] Trying to display the error log at the bottom of the page')\n", "accordion\n" ] } diff --git a/project/ui/qprof_main.ipynb b/project/ui/qprof_main.ipynb index e7ff599a..35e67380 100644 --- a/project/ui/qprof_main.ipynb +++ b/project/ui/qprof_main.ipynb @@ -18,7 +18,7 @@ "metadata": {}, "outputs": [], "source": [ - "logging.info('Importing Libraries [Query Profile Main Page]')\n", + "logging.info('[Query Profile Main Page] Importing Libraries')\n", "from ipywidgets import interact, interactive, fixed, interact_manual\n", "import ipywidgets as widgets\n", "import verticapy as vp\n", @@ -31,7 +31,7 @@ "from verticapy.performance.vertica import QueryProfilerInterface\n", "from verticapy.connection.errors import ConnectionError\n", "vp.set_option(\"print_info\", False)\n", - "logging.info('Successfully Imported Libraries [Query Profile Main Page]')" + "logging.info('[Query Profile Main Page] Successfully Imported Libraries')" ] }, { @@ -108,7 +108,7 @@ "except ConnectionError:\n", " print(\"\\033[91m\\033[1m WARNING: No database connection found. Please connect with a database to use this tool. \\033[0m\\033[0m\")\n", "\n", - "logging.info('Done with printing database connection details [Query Profile Main Page]')" + "logging.info('[Query Profile Main Page] Done with printing database connection details ')" ] }, { @@ -146,7 +146,7 @@ " with output_2:\n", " key_val = key.value\n", " target_schema_val = target_schema.value\n", - " logging.info(f\"For load from schema and key option, saved key value as :{key_val}, target schema as {target_schema_val}. [Query Profile Main Page]\")\n", + " logging.info(f\"[Query Profile Main Page] For load from schema and key option, saved key value as :{key_val}, target schema as {target_schema_val}. \")\n", " reset_values(key_val = key_val, target_schema_val = target_schema_val)\n", "\n", "button_2.on_click(on_button_clicked_2)\n", @@ -163,7 +163,7 @@ " key_val = key.value\n", " target_schema_val = target_schema.value\n", " file_val = uploader.value\n", - " logging.info(f\"For load from file option, saved key value as :{key_val}, target schema as {target_schema_val}, file name as {file_val}. [Query Profile Main Page]\")\n", + " logging.info(f\"[Query Profile Main Page] For load from file option, saved key value as :{key_val}, target schema as {target_schema_val}, file name as {file_val}.\")\n", " if target_schema_val == \"\" or file_val == \"\":\n", " print(\"Error! You must provide a value for Schema and File.\")\n", " return\n", @@ -194,9 +194,9 @@ "child_2 = widgets.VBox([target_schema,key,uploader,button_3, output_3])\n", "tab.children = [child_1, child_2]\n", "tab.titles = [\"From database\", \"From a file\"]\n", - "logging.info('Trying to display the load tab [Query Profile Main Page]')\n", + "logging.info('[Query Profile Main Page] Trying to display the load tab')\n", "display(tab)\n", - "logging.info('Successfully loaded [Query Profile Main Page]')" + "logging.info('[Query Profile Main Page] Successfully loaded')" ] }, { @@ -229,10 +229,10 @@ "def on_button_clicked_01(b):\n", " output_01.clear_output(wait=True)\n", " with output_01:\n", - " logging.info('Trying to fetch the queries from query_request table [Query Profile Main Page]')\n", + " logging.info('[Query Profile Main Page] Trying to fetch the queries from query_request table')\n", " sql_query = \"SELECT * from query_requests WHERE request_type = 'QUERY' AND request LIKE 'select%' ORDER BY request_duration_ms DESC LIMIT 6;\"\n", " result = vp.vDataFrame(sql_query)\n", - " logging.info('Successfully fetched the queries from query_request table [Query Profile Main Page]')\n", + " logging.info('[Query Profile Main Page] Successfully fetched the queries from query_request table')\n", " display(HTML(result._repr_html_()))\n", " \n", "logging.info('Trying to display Query Request Table button [Query Profile Main Page]')\n", @@ -288,7 +288,7 @@ " key_val_2 = key_2.value\n", " transaction_val = transaction.value\n", " statement_val = statement.value\n", - " logging.info(f\"For create option, saved key value as :{key_val_2}, target schema as {target_schema_val_2}, transaction id as {transaction_val}, statement id as {statement_val}. [Query Profile Main Page]\")\n", + " logging.info(f\"[Query Profile Main Page] For create option, saved key value as :{key_val_2}, target schema as {target_schema_val_2}, transaction id as {transaction_val}, statement id as {statement_val}.\")\n", " reset_values(statement_val = statement_val, transaction_val = transaction_val, target_schema_val_2 = target_schema_val_2, key_val_2 = key_val_2)\n", "\n", "button_1.on_click(on_button_clicked_1)\n", @@ -328,7 +328,7 @@ " target_schema_val_2 = target_schema_2.value\n", " key_val_2 = key_2.value\n", " query_val = query.value\n", - " logging.info(f\"\"\"For create using query option, saved key value as :{key_val_2}, target schema as {target_schema_val_2}, query as \"{query_val}\". [Query Profile Main Page]\"\"\")\n", + " logging.info(f\"\"\"[Query Profile Main Page] For create using query option, saved key value as :{key_val_2}, target schema as {target_schema_val_2}, query as \"{query_val}\".\"\"\")\n", " reset_values(query_val = query_val, target_schema_val_2 = target_schema_val_2, key_val_2 = key_val_2)\n", "\n", "button.on_click(on_button_clicked_0)\n", @@ -366,7 +366,7 @@ " target_schema_val_2 = target_schema_2.value\n", " key_val_2 = key_2.value\n", " transaction_statement_list_val = transaction_statement_list.value\n", - " logging.info(f\"For create using multiple transaction ids and keys, saved key value as :{key_val_2}, target schema as {target_schema_val_2}, List of transactions and statements as {transaction_statement_list_val}. [Query Profile Main Page]\")\n", + " logging.info(f\"[Query Profile Main Page] For create using multiple transaction ids and keys, saved key value as :{key_val_2}, target schema as {target_schema_val_2}, List of transactions and statements as {transaction_statement_list_val}.\")\n", " reset_values(transaction_statement_list_val = transaction_statement_list_val, target_schema_val_2 = target_schema_val_2, key_val_2 = key_val_2)\n", "\n", "button_4.on_click(on_button_clicked_4)\n", @@ -402,7 +402,7 @@ "outputs": [], "source": [ "from IPython.display import HTML\n", - "\n", + "logging.info(f\"[Query Profile Main Page] Running script for HTML display\")\n", "display(\n", " HTML(\n", " \"\"\"\n",