Skip to content

Commit

Permalink
log start, end and total time taken for processing (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wambere authored Feb 14, 2024
1 parent 7f9222d commit 206aeb8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions importer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import requests
import logging
import backoff
from datetime import datetime
from oauthlib.oauth2 import LegacyApplicationClient
from requests_oauthlib import OAuth2Session

Expand Down Expand Up @@ -861,6 +862,9 @@ def main(
elif log_level == "ERROR":
logging.basicConfig(level=logging.ERROR)

start_time = datetime.now()
logging.info("Start time: " + start_time.strftime("%H:%M:%S"))

logging.info("Starting csv import...")
resource_list = read_csv(csv_file)
if resource_list:
Expand Down Expand Up @@ -939,6 +943,10 @@ def main(
else:
logging.error("Empty csv file!")

end_time = datetime.now()
logging.info("End time: " + end_time.strftime("%H:%M:%S"))
total_time = end_time - start_time
logging.info("Total time: " + str(total_time.total_seconds()) + " seconds")

if __name__ == "__main__":
main()

0 comments on commit 206aeb8

Please sign in to comment.