-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
33 lines (27 loc) · 1.18 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from app.ingest_data import DataIngestor
from app.calculate_metrics import MetricsCalculation
import pandas as pd
import time
import os
# Metrics collection
if os.path.isfile('./data/performance/performance_metrics.csv'):
metrics = pd.read_csv('./data/performance/performance_metrics.csv')
else:
metrics = pd.DataFrame()
channels, parameters, metrics = DataIngestor.ingest_data('./data/channels.txt',
'./data/parameters.txt',
metrics)
channels, parameters, metrics = MetricsCalculation.calculate_metrics(
channels, parameters, metrics)
# Performance metrics gathering for data persistence
if metrics is not None:
start = time.time()
MetricsCalculation.persist_data(channels, 'channels')
MetricsCalculation.persist_data(parameters, 'parameters')
# Performance metrics gathering for data persistence
if metrics is not None:
end = time.time()
metrics = metrics.append({'key': 'metrics_persisting', 'value': end-start},
ignore_index=True)
if metrics is not None:
metrics.to_csv('./data/performance/performance_metrics.csv', index=False)