Skip to content
Snippets Groups Projects
Commit 485bd790 authored by Carsten Hinz's avatar Carsten Hinz
Browse files

added first documentation to benchmark script

removed extraction of a single day from benchmark -> seems to cause
crashes.

added output directories of benchmark script to ignore
parent 0559aabe
Branches
Tags
1 merge request!11Creation of first beta release version
...@@ -8,3 +8,4 @@ tests/cache/ ...@@ -8,3 +8,4 @@ tests/cache/
tests/data/ tests/data/
data/ data/
tests/results tests/results
tests/temp_data_cache/
from datetime import datetime, timedelta from datetime import datetime, timedelta
"""
Script for benchmarking the performance of the TOAR Database.
The script relies on the AnalysisServiceDownload for downloading the requested data.
For a subsequent request, the already downloaded data are not considered.
The script contains two ways to access the databse:
- a manual way without downloading the data (not used)
- usage of the AnalysisService created for this module
The output of this script are the durations of the requests. Each call is ended with the duration for this interval.
Meanwhile, the status outputs of the analysis service are given.
"""
import time import time
import requests import requests
from pathlib import Path from pathlib import Path
...@@ -79,7 +95,18 @@ def wait_for_client_response(client, sample): ...@@ -79,7 +95,18 @@ def wait_for_client_response(client, sample):
print(f"time out after 30min, try {half_hours+1}") print(f"time out after 30min, try {half_hours+1}")
def time_rest_client_response(start, end): def time_rest_client_response(start :datetime, end:datetime):
"""benchmark function using the AnalysisService with download of the requested data
Parameters:
----------
start:
start time point
end:
end time point
Results:
Prints duration and number of tries, i.e. number of calls of get_data, which times out after 30min.
"""
print(f"starting request for {start}-{end}") print(f"starting request for {start}-{end}")
path_cache = TEST_ROOT / "temp_data_cache" path_cache = TEST_ROOT / "temp_data_cache"
...@@ -106,7 +133,7 @@ def time_rest_client_response(start, end): ...@@ -106,7 +133,7 @@ def time_rest_client_response(start, end):
if __name__ == "__main__": if __name__ == "__main__":
time_windows = [ time_windows = [
(datetime(2010, 1, 1), datetime(2010, 1, 2)), #(datetime(2010, 1, 1), datetime(2010, 1, 2)),#this line seems to cause crashes
(datetime(2010, 1, 1), datetime(2010, 1, 8)), (datetime(2010, 1, 1), datetime(2010, 1, 8)),
(datetime(2010, 1, 1), datetime(2010, 1, 31)), (datetime(2010, 1, 1), datetime(2010, 1, 31)),
(datetime(2010, 1, 1), datetime(2010, 12, 31)), (datetime(2010, 1, 1), datetime(2010, 12, 31)),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment