Exemple #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))
Exemple #2
0
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),
        ))
Exemple #3
0
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]