MCPcopy Create free account
hub / github.com/dbt-labs/ade-bench / run_profiling_and_import

Function run_profiling_and_import

scripts_python/profiling_statistics.py:619–660  ·  view source on GitHub ↗
(
    n_runs: int = 200,
    max_retries: int = 10,
    profiling_script: str = "./scripts_bash/start_profiling_session.sh",
    extra_args: list = None,
    summaries_dir: str = "profiling/summaries",
    base_dir: str = "profiling",
)

Source from the content-addressed store, hash-verified

617
618
619def run_profiling_and_import(
620 n_runs: int = 200,
621 max_retries: int = 10,
622 profiling_script: str = "./scripts_bash/start_profiling_session.sh",
623 extra_args: list = None,
624 summaries_dir: str = "profiling/summaries",
625 base_dir: str = "profiling",
626) -> str:
627 extra_args = extra_args or []
628 summaries_path = Path(summaries_dir)
629 summaries_path.mkdir(parents=True, exist_ok=True)
630
631 db_path = generate_db_path(base_dir)
632 conn = create_database(db_path)
633 conn.close()
634
635 successful_runs = 0
636 total_attempts = 0
637
638 with tqdm(total=n_runs, desc="Profiling runs") as pbar:
639 while successful_runs < n_runs and total_attempts < n_runs + max_retries:
640 pbar.set_postfix_str(f"Attempt {total_attempts + 1}")
641 total_attempts += 1
642
643 if run_profiling_session(profiling_script, extra_args):
644 latest_folder = get_latest_summary_folder(summaries_path)
645 if latest_folder:
646 conn = sqlite3.connect(db_path)
647 if import_single_folder(conn, latest_folder):
648 successful_runs += 1
649 pbar.update(1)
650 pbar.set_postfix_str(f"Success {successful_runs}/{n_runs}")
651 conn.close()
652
653 tqdm.write(
654 f"\nCompleted {successful_runs}/{n_runs} successful runs in {total_attempts} attempts"
655 )
656 tqdm.write(f"Database: {db_path}")
657
658 generate_all_charts(db_path)
659
660 return db_path
661
662
663if __name__ == "__main__":

Callers 1

Calls 6

run_profiling_sessionFunction · 0.85
import_single_folderFunction · 0.85
generate_all_chartsFunction · 0.85
generate_db_pathFunction · 0.70
create_databaseFunction · 0.70

Tested by

no test coverage detected