aiforge_python/config.py

46 lines
1.3 KiB
Python

import os
import pathlib
from datetime import datetime
from utils import create_logger
def ensure_exist(filePath):
dir = pathlib.Path(os.path.dirname(filePath))
if not dir.exists():
os.makedirs(os.path.dirname(filePath))
file=pathlib.Path(filePath)
if file.is_file() and not file.exists():
file.touch()
# 项目根目录
root_path = os.path.abspath(os.path.dirname(__file__))
# 创建日志对象
log_file = root_path + '/logs/' + str(datetime.date(datetime.now())) + '.log'
ensure_exist(log_file)
logger = create_logger(log_file)
# PostgreSQL连接配置
host = '118.31.13.117'
user = 'postgres'
passwd = 'Edu_123123pos'
port = 55432
database = 'opendata'
# 各子模型目录
activity_analysis_path = root_path + '/user_portrait_analysis/activity_analysis/'
contribution_analysis_path = root_path + '/user_portrait_analysis/contribution_analysis/'
interests_analysis_path = root_path + '/interests_analysis/'
learning_ability_analysis_path = root_path + '/learning_ability_analysis/'
programming_ability_analysis_path = root_path + '/programming_ability_analysis/'
professional_ability_analysis_path = root_path + '/professional_ability_analysis/'
user_label_analysis_path = root_path + '/user_label_analysis/'
# 之前登录的天数
before_login_days = 30
data_before_days = 100000
test_user_id = 10
# 随机数种子
RANDOM_SEED = 42