Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 46 additions & 21 deletions project/ui/qprof-ui.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -420,46 +420,71 @@
"\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\"<p style='color:red'>The following error occurred while preparing the WHERE clause: </p> <p> {e}</p>\"))\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",
" WHERE {where_clause}\n",
" 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\"<p style='color:red'>The following error occurred while loading DC SLOW EVENTS: </p> <p> {e}</p>\"))\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\"<p style='color:red'>The following error occurred while loading DC OPTIMIZER EVENTS: </p> <p> {e}</p>\"))\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\"<p style='color:red'>The following error occured: </p> <p> {e}</p>\"))\n",
" with table_2:\n",
" display(widgets.HTML(f\"<p style='color:red'>The following error occured: </p> <p> {e}</p>\"))\n",
" with table_file_reads:\n",
" display(widgets.HTML(f\"<p style='color:red'>The following error occurred while loading DC FILE READS: </p> <p> {e}</p>\"))\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",
Expand Down