-
Notifications
You must be signed in to change notification settings - Fork 0
/
utilities.py
36 lines (27 loc) · 1.21 KB
/
utilities.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
34
35
36
import socket
from dotenv import load_dotenv
import os
from pathlib import Path
from dataclasses import dataclass
class Environment:
def __init__(self):
if socket.gethostname().startswith('Deas'):
load_dotenv(dotenv_path= './local_env.yml')
else:
load_dotenv(dotenv_path= './server_env.yml')
self.PANDAS_ASV_RESULTS_PATH = os.getenv("PANDAS_ASV_RESULTS_PATH")
self.BENCHMARKS_FILE_PATH = os.getenv("BENCHMARKS_FILE_PATH")
self.GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY")
self.CONBENCH_RUN_REASON = os.getenv("CONBENCH_RUN_REASON")
self.ASV_PROCESSED_FILES = os.getenv("ASV_PROCESSED_FILES")
self.ALERT_PROCESSED_FILES = os.getenv("ALERT_PROCESSED_FILES")
def check_new_files(env):
benchmarks_path = Path(env.PANDAS_ASV_RESULTS_PATH)
all_files = [str(file) for file in benchmarks_path.glob('*.json')]
with open(env.ASV_PROCESSED_FILES, "r+") as f:
processed_files = f.read().split('\n')
return all_files, processed_files
def alerts_done_file(env):
with open(env.ALERT_PROCESSED_FILES, "r+") as f:
alert_sent_files = f.read().split('\n')
return alert_sent_files