-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
45 lines (35 loc) · 826 Bytes
/
settings.py
File metadata and controls
45 lines (35 loc) · 826 Bytes
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
37
38
39
40
41
42
43
44
45
import os,errno
from log import logger as logger
CLICKHOUSE = {
'port': '9000',
'host': 'localhost',
'db_export': '',
'bin': ''
}
BASE_TABLE = ''
FILE_LOG = 'synclogs.txt'
WATCHER = {
'timedelta': -86400*2
}
def check_file():
"""Create sync file"""
flags = os.O_CREAT | os.O_EXCL | os.O_WRONLY
try:
q=os.open(FILE_LOG, flags)
os.close(q)
except Exception:
return False
else:
return True
def remove_file():
try:
os.remove(FILE_LOG)
except Exception:
logger.error('Can\'t delete file: %s', FILE_LOG)
def process_file(text):
with open(FILE_LOG, 'a') as file:
file.writelines(text + '\n')
os.utime(FILE_LOG, None)
def get_data_file():
file = open(FILE_LOG, 'r')
return file.read().splitlines()