diff --git a/project/ui/qprof-ui.ipynb b/project/ui/qprof-ui.ipynb index e5a1172e..c8497090 100644 --- a/project/ui/qprof-ui.ipynb +++ b/project/ui/qprof-ui.ipynb @@ -420,15 +420,21 @@ "\n", "def on_button_clicked_other_info(b):\n", " button_other_info.disabled = True\n", - " table_1.clear_output(wait=True)\n", - " table_2.clear_output(wait=True)\n", + " table_slow_events.clear_output(wait=True)\n", + " table_optimizer_events.clear_output(wait=True)\n", + " table_file_reads.clear_output(wait=True)\n", + " \n", " try:\n", " transaction_statement_list = qprof.transactions\n", " logging.info(f'[Query Profile Tree Page] The list of transaction and statement ids are: {transaction_statement_list}')\n", - " # Construct the WHERE clause dynamically\n", " where_clause = \" OR \".join([f\"(transaction_id = {elem[0]} AND statement_id = {elem[1]})\" for elem in transaction_statement_list])\n", - " \n", - " # Construct the query\n", + " except Exception as e:\n", + " with table_slow_events:\n", + " display(widgets.HTML(f\"
The following error occurred while preparing the WHERE clause:
{e}
\"))\n", + " button_other_info.disabled = False\n", + " return\n", + "\n", + " try:\n", " query = f\"\"\"\n", " SELECT transaction_id, statement_id, node_name, event_description, time, duration_us/1000000 AS duration_sec\n", " FROM dc_slow_events\n", @@ -436,30 +442,49 @@ " ORDER BY duration_sec DESC\n", " LIMIT 500;\n", " \"\"\"\n", - " query_2 = f\"\"\"\n", + " logging.info(f'[Query Profile Tree Page] Trying to get the DC SLOW EVENTS table')\n", + " res_slow_events = vp.vDataFrame(f\"\"\"{query}\"\"\")\n", + " with table_slow_events:\n", + " res_slow_events.idisplay()\n", + " except Exception as e:\n", + " with table_slow_events:\n", + " display(widgets.HTML(f\"The following error occurred while loading DC SLOW EVENTS:
{e}
\"))\n", + "\n", + " try:\n", + " query = f\"\"\"\n", " SELECT *\n", " FROM dc_optimizer_events\n", " WHERE {where_clause};\n", " \"\"\"\n", - " logging.info(f'[Query Profile Tree Page] Trying to get the DC SLOW EVENTS table')\n", - " res_1 = vp.vDataFrame(f\"\"\"{query}\"\"\")\n", - " res_2 = vp.vDataFrame(f\"\"\"{query_2}\"\"\")\n", - " with table_1:\n", - " res_1.idisplay()\n", - " with table_2:\n", - " res_2.idisplay()\n", + " res_optimizer_events = vp.vDataFrame(f\"\"\"{query}\"\"\")\n", + " with table_optimizer_events:\n", + " res_optimizer_events.idisplay()\n", + " except Exception as e:\n", + " with table_optimizer_events:\n", + " display(widgets.HTML(f\"The following error occurred while loading DC OPTIMIZER EVENTS:
{e}
\"))\n", + "\n", + " try:\n", + " query = f\"\"\"\n", + " SELECT *\n", + " FROM dc_file_reads\n", + " WHERE {where_clause};\n", + " \"\"\"\n", + " res_file_reads = vp.vDataFrame(f\"\"\"{query}\"\"\")\n", + " with table_file_reads:\n", + " res_file_reads.idisplay()\n", " except Exception as e:\n", - " with table_1:\n", - " display(widgets.HTML(f\"The following error occured:
{e}
\"))\n", - " with table_2:\n", - " display(widgets.HTML(f\"The following error occured:
{e}
\"))\n", + " with table_file_reads:\n", + " display(widgets.HTML(f\"The following error occurred while loading DC FILE READS:
{e}
\"))\n", + "\n", " button_other_info.disabled = False\n", + "\n", " \n", - "table_1 = widgets.Output()\n", - "table_2 = widgets.Output()\n", + "table_slow_events = widgets.Output()\n", + "table_optimizer_events = widgets.Output()\n", + "table_file_reads = widgets.Output()\n", "tables = widgets.Tab()\n", - "tables.children = [table_1, table_2]\n", - "tables.titles = [\"Slow Events\", \"Optimizer Events\"]\n", + "tables.children = [table_slow_events, table_optimizer_events, table_file_reads]\n", + "tables.titles = [\"Slow Events\", \"Optimizer Events\", \"File Reads\"]\n", "other_info = widgets.VBox([button_other_info, tables])\n", "\n", "button_other_info.on_click(on_button_clicked_other_info)\n",