예제 #1
0
def convert_exisiting():
    """
    Update existing missing logs to database
    """
    data_path = root_path()
    if not data_path: return

    with db.SQLite(f'{data_path}/Logs/xbbg.db') as con:
        con.execute(TRIALS_TABLE)
        for item in all_trials():
            con.execute(db.replace_into(table='trials', **item))
예제 #2
0
파일: trials.py 프로젝트: tagomatech/xbbg
def update_trials(**kwargs):
    """
    Update number of trials for missing values
    """
    data_path = root_path()
    if not data_path: return

    if 'cnt' not in kwargs:
        kwargs['cnt'] = num_trials(**kwargs) + 1

    with db.SQLite(f'{data_path}/Logs/xbbg.db') as con:
        con.execute(TRIALS_TABLE)
        con.execute(db.replace_into(
            table='trials',
            **trail_info(**kwargs),
        ))
예제 #3
0
파일: trials.py 프로젝트: tagomatech/xbbg
def num_trials(**kwargs) -> int:
    """
    Check number of trials for missing values

    Returns:
        int: number of trials already tried
    """
    data_path = root_path()
    if not data_path: return 0

    with db.SQLite(f'{data_path}/Logs/xbbg.db') as con:
        con.execute(TRIALS_TABLE)
        num = con.execute(db.select(
            table='trials',
            **trail_info(**kwargs),
        )).fetchall()
        if not num: return 0
        return num[0][-1]