Skip to content

Commit

Permalink
Print total time when done
Browse files Browse the repository at this point in the history
  • Loading branch information
kofrezo committed Jul 21, 2023
1 parent a968c8f commit 31c1689
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions serveradmin/graphite/management/commands/cache_graphite.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def add_arguments(self, parser: CommandParser) -> None:
def handle(self, *args, **options):
"""The entry point of the command"""

start = time.time()

sprite_params = settings.GRAPHITE_SPRITE_PARAMS
sprite_dir = settings.MEDIA_ROOT + '/graph_sprite'
if not isdir(sprite_dir):
Expand Down Expand Up @@ -78,6 +80,9 @@ def handle(self, *args, **options):

self.stdout.write(f"[{now()}] Finished collection {collection}")

end = time.time()
self.stdout.write(self.style.SUCCESS(f"Total time: {end - start:.2f} seconds."))

def generate_sprite(self, collection_dir, graph_table, server):
"""Generate sprites for the given server using the given collection"""
graphs = [v2 for k1, v1 in graph_table for k2, v2 in v1]
Expand Down

0 comments on commit 31c1689

Please sign in to comment.