Skip to content

Commit

Permalink
add timing to cli make function
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbrandreth committed Jan 28, 2025
1 parent c971a8b commit 4cd41fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/scripts/miade.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import datetime
import logging
import re
import time
from typing_extensions import Dict

import typer
Expand Down Expand Up @@ -628,6 +629,7 @@ def make(config_filepath: Path, temp_dir: Path = Path("./.temp"), output: Path =
"""
Build a model from a specification file.
"""
start_time = time.time()
log.info(f"Making temporary directory: {temp_dir}")
temp_dir.mkdir(parents=True, exist_ok=True)

Expand Down Expand Up @@ -814,6 +816,12 @@ def make(config_filepath: Path, temp_dir: Path = Path("./.temp"), output: Path =

rmtree(temp_dir)

elapsed_time = time.time() - start_time
hours = int(elapsed_time // 3600)
minutes = int((elapsed_time % 3600) // 60)
seconds = int(elapsed_time % 60)
print(f"Time taken: {hours}h {minutes}m {seconds}s")


if __name__ == "__main__":
app()

0 comments on commit 4cd41fb

Please sign in to comment.