Skip to content

Commit

Permalink
Display %load command execution time as HH:MM:SS for large values (#121)
Browse files Browse the repository at this point in the history
* Display %load command execution time as HH:MM:SS for large values

* Update changelog

Co-authored-by: Michael Chin <[email protected]>
  • Loading branch information
michaelnchin and michaelnchin authored May 6, 2021
1 parent a36e698 commit 912692c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Starting with v1.31.6, this file will contain a record of major features and upd
- Add support for notebook variables in Sparql/Gremlin magic queries ([Link to PR](https://github.com/aws/graph-notebook/pull/113))
- Add support for grouping by different properties per label in Gremlin ([Link to PR](https://github.com/aws/graph-notebook/pull/115))
- Fix missing Boto3 dependency in setup.py ([Link to PR](https://github.com/aws/graph-notebook/pull/118))

- Update %load execution time to HH:MM:SS format if over a minute ([Link to PR](https://github.com/aws/graph-notebook/pull/121))

## Release 2.1.1 (April 22, 2021)

Expand Down
8 changes: 7 additions & 1 deletion src/graph_notebook/magics/graph_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import logging
import json
import time
import datetime
import os
import uuid
from enum import Enum
Expand Down Expand Up @@ -823,7 +824,12 @@ def on_button_clicked(b):
print(f'Overall Status: {interval_check_response["payload"]["overallStatus"]["status"]}')
if interval_check_response["payload"]["overallStatus"]["status"] in FINAL_LOAD_STATUSES:
execution_time = interval_check_response["payload"]["overallStatus"]["totalTimeSpent"]
execution_time_statement = '<1 second' if execution_time == 0 else f'{execution_time} seconds'
if execution_time == 0:
execution_time_statement = '<1 second'
elif execution_time > 59:
execution_time_statement = str(datetime.timedelta(seconds=execution_time))
else:
execution_time_statement = f'{execution_time} seconds'
print('Total execution time: ' + execution_time_statement)
interval_output.close()
print('Done.')
Expand Down

0 comments on commit 912692c

Please sign in to comment.