|
420 | 420 | "\n", |
421 | 421 | "def on_button_clicked_other_info(b):\n", |
422 | 422 | " button_other_info.disabled = True\n", |
423 | | - " table_1.clear_output(wait=True)\n", |
424 | | - " table_2.clear_output(wait=True)\n", |
| 423 | + " table_slow_events.clear_output(wait=True)\n", |
| 424 | + " table_optimizer_events.clear_output(wait=True)\n", |
| 425 | + " table_file_reads.clear_output(wait=True)\n", |
| 426 | + " \n", |
425 | 427 | " try:\n", |
426 | 428 | " transaction_statement_list = qprof.transactions\n", |
427 | 429 | " logging.info(f'[Query Profile Tree Page] The list of transaction and statement ids are: {transaction_statement_list}')\n", |
428 | | - " # Construct the WHERE clause dynamically\n", |
429 | 430 | " where_clause = \" OR \".join([f\"(transaction_id = {elem[0]} AND statement_id = {elem[1]})\" for elem in transaction_statement_list])\n", |
430 | | - " \n", |
431 | | - " # Construct the query\n", |
| 431 | + " except Exception as e:\n", |
| 432 | + " with table_slow_events:\n", |
| 433 | + " display(widgets.HTML(f\"<p style='color:red'>The following error occurred while preparing the WHERE clause: </p> <p> {e}</p>\"))\n", |
| 434 | + " button_other_info.disabled = False\n", |
| 435 | + " return\n", |
| 436 | + "\n", |
| 437 | + " try:\n", |
432 | 438 | " query = f\"\"\"\n", |
433 | 439 | " SELECT transaction_id, statement_id, node_name, event_description, time, duration_us/1000000 AS duration_sec\n", |
434 | 440 | " FROM dc_slow_events\n", |
435 | 441 | " WHERE {where_clause}\n", |
436 | 442 | " ORDER BY duration_sec DESC\n", |
437 | 443 | " LIMIT 500;\n", |
438 | 444 | " \"\"\"\n", |
439 | | - " query_2 = f\"\"\"\n", |
| 445 | + " logging.info(f'[Query Profile Tree Page] Trying to get the DC SLOW EVENTS table')\n", |
| 446 | + " res_slow_events = vp.vDataFrame(f\"\"\"{query}\"\"\")\n", |
| 447 | + " with table_slow_events:\n", |
| 448 | + " res_slow_events.idisplay()\n", |
| 449 | + " except Exception as e:\n", |
| 450 | + " with table_slow_events:\n", |
| 451 | + " display(widgets.HTML(f\"<p style='color:red'>The following error occurred while loading DC SLOW EVENTS: </p> <p> {e}</p>\"))\n", |
| 452 | + "\n", |
| 453 | + " try:\n", |
| 454 | + " query = f\"\"\"\n", |
440 | 455 | " SELECT *\n", |
441 | 456 | " FROM dc_optimizer_events\n", |
442 | 457 | " WHERE {where_clause};\n", |
443 | 458 | " \"\"\"\n", |
444 | | - " logging.info(f'[Query Profile Tree Page] Trying to get the DC SLOW EVENTS table')\n", |
445 | | - " res_1 = vp.vDataFrame(f\"\"\"{query}\"\"\")\n", |
446 | | - " res_2 = vp.vDataFrame(f\"\"\"{query_2}\"\"\")\n", |
447 | | - " with table_1:\n", |
448 | | - " res_1.idisplay()\n", |
449 | | - " with table_2:\n", |
450 | | - " res_2.idisplay()\n", |
| 459 | + " res_optimizer_events = vp.vDataFrame(f\"\"\"{query}\"\"\")\n", |
| 460 | + " with table_optimizer_events:\n", |
| 461 | + " res_optimizer_events.idisplay()\n", |
| 462 | + " except Exception as e:\n", |
| 463 | + " with table_optimizer_events:\n", |
| 464 | + " display(widgets.HTML(f\"<p style='color:red'>The following error occurred while loading DC OPTIMIZER EVENTS: </p> <p> {e}</p>\"))\n", |
| 465 | + "\n", |
| 466 | + " try:\n", |
| 467 | + " query = f\"\"\"\n", |
| 468 | + " SELECT *\n", |
| 469 | + " FROM dc_file_reads\n", |
| 470 | + " WHERE {where_clause};\n", |
| 471 | + " \"\"\"\n", |
| 472 | + " res_file_reads = vp.vDataFrame(f\"\"\"{query}\"\"\")\n", |
| 473 | + " with table_file_reads:\n", |
| 474 | + " res_file_reads.idisplay()\n", |
451 | 475 | " except Exception as e:\n", |
452 | | - " with table_1:\n", |
453 | | - " display(widgets.HTML(f\"<p style='color:red'>The following error occured: </p> <p> {e}</p>\"))\n", |
454 | | - " with table_2:\n", |
455 | | - " display(widgets.HTML(f\"<p style='color:red'>The following error occured: </p> <p> {e}</p>\"))\n", |
| 476 | + " with table_file_reads:\n", |
| 477 | + " display(widgets.HTML(f\"<p style='color:red'>The following error occurred while loading DC FILE READS: </p> <p> {e}</p>\"))\n", |
| 478 | + "\n", |
456 | 479 | " button_other_info.disabled = False\n", |
| 480 | + "\n", |
457 | 481 | " \n", |
458 | | - "table_1 = widgets.Output()\n", |
459 | | - "table_2 = widgets.Output()\n", |
| 482 | + "table_slow_events = widgets.Output()\n", |
| 483 | + "table_optimizer_events = widgets.Output()\n", |
| 484 | + "table_file_reads = widgets.Output()\n", |
460 | 485 | "tables = widgets.Tab()\n", |
461 | | - "tables.children = [table_1, table_2]\n", |
462 | | - "tables.titles = [\"Slow Events\", \"Optimizer Events\"]\n", |
| 486 | + "tables.children = [table_slow_events, table_optimizer_events, table_file_reads]\n", |
| 487 | + "tables.titles = [\"Slow Events\", \"Optimizer Events\", \"File Reads\"]\n", |
463 | 488 | "other_info = widgets.VBox([button_other_info, tables])\n", |
464 | 489 | "\n", |
465 | 490 | "button_other_info.on_click(on_button_clicked_other_info)\n", |
|
0 commit comments