qcodes/dataset/database_fix_functions.py
def fix_wrong_run_descriptions(conn: ConnectionPlus,
                               run_ids: Sequence[int]) -> None:
    """
    NB: This is a FIX function. Do not use it unless your database has been
    diagnosed with the problem that this function fixes.

    Overwrite faulty run_descriptions by using information from the layouts and
    dependencies tables. If a correct description is found for a run, that
    run is left untouched.

    Args:
        conn: The connection to the database
        run_ids: The runs to (potentially) fix
    """

    user_version = get_user_version(conn)

    if not user_version == 3:
        raise RuntimeError('Database of wrong version. Will not apply fix. '
                           'Expected version 3, found version {user_version}')


    log.info('[*] Fixing run descriptions...')
    for run_id in run_ids:
        trusted_paramspecs = _get_parameters(conn, run_id)
        interdeps = v0.InterDependencies(*trusted_paramspecs)
        interdeps_ = old_to_new(interdeps)
        trusted_desc = RunDescriber(interdeps_)

        actual_desc_str = select_one_where(conn, "runs",
                                           "run_description",
                                           "run_id", run_id)

        trusted_json = serial.to_json_as_version(trusted_desc, 0)

        if actual_desc_str == trusted_json:
            log.info(f'[+] Run id: {run_id} had an OK description')
        else:
            log.info(f'[-] Run id: {run_id} had a broken description. '
                     f'Description found: {actual_desc_str}')
            update_run_description(conn, run_id, trusted_json)
            log.info(f'    Run id: {run_id} has been updated.')

    NB: This is a FIX function. Do not use it unless your database has been
    diagnosed with the problem that this function fixes.

    Overwrite faulty run_descriptions by using information from the layouts and
    dependencies tables. If a correct description is found for a run, that
    run is left untouched.

    Args:
        conn: The connection to the database
        run_ids: The runs to (potentially) fix
    
This is a FIX function. Do not use it unless your database has been
diagnosed with the problem that this function fixes.

Overwrite faulty run_descriptions by using information from the layouts and
dependencies tables. If a correct description is found for a run, that
run is left untouched.
This is a FIX function . Do not use it unless your database has been diagnosed with the problem that this function fixes . Overwrite faulty run_descriptions by using information from the layouts and dependencies tables . If a correct description is found for a run that run is left untouched .
def fix_wrong_run_descriptions(conn: ConnectionPlus,
                               run_ids: Sequence[int]) -> None:
    user_version = get_user_version(conn)
    if not user_version == 3:
        raise RuntimeError('Database of wrong version. Will not apply fix. '
                           'Expected version 3, found version {user_version}')
    log.info('[*] Fixing run descriptions...')
    for run_id in run_ids:
        trusted_paramspecs = _get_parameters(conn, run_id)
        interdeps = v0.InterDependencies(*trusted_paramspecs)
        interdeps_ = old_to_new(interdeps)
        trusted_desc = RunDescriber(interdeps_)
        actual_desc_str = select_one_where(conn, "runs",
                                           "run_description",
                                           "run_id", run_id)
        trusted_json = serial.to_json_as_version(trusted_desc, 0)
        if actual_desc_str == trusted_json:
            log.info(f'[+] Run id: {run_id} had an OK description')
        else:
            log.info(f'[-] Run id: {run_id} had a broken description. '
                     f'Description found: {actual_desc_str}')
            update_run_description(conn, run_id, trusted_json)
            log.info(f'    Run id: {run_id} has been updated.')
def fix_wrong_run_descriptions ( conn : ConnectionPlus , run_ids : Sequence [ int ] ) -> None : user_version = get_user_version ( conn ) if not user_version == 3 : raise RuntimeError ( 'Database of wrong version. Will not apply fix. ' 'Expected version 3, found version {user_version}' ) log . info ( '[*] Fixing run descriptions...' ) for run_id in run_ids : trusted_paramspecs = _get_parameters ( conn , run_id ) interdeps = v0 . InterDependencies ( * trusted_paramspecs ) interdeps_ = old_to_new ( interdeps ) trusted_desc = RunDescriber ( interdeps_ ) actual_desc_str = select_one_where ( conn , "runs" , "run_description" , "run_id" , run_id ) trusted_json = serial . to_json_as_version ( trusted_desc , 0 ) if actual_desc_str == trusted_json : log . info ( f'[+] Run id: {run_id} had an OK description' ) else : log . info ( f'[-] Run id: {run_id} had a broken description. ' f'Description found: {actual_desc_str}' ) update_run_description ( conn , run_id , trusted_json ) log . info ( f'    Run id: {run_id} has been updated.' )
NB: This is a FIX function.
NB : This is a FIX function .
"""
    NB: This is a FIX function. Do not use it unless your database has been
    diagnosed with the problem that this function fixes.

    Overwrite faulty run_descriptions by using information from the layouts and
    dependencies tables. If a correct description is found for a run, that
    run is left untouched.

    Args:
        conn: The connection to the database
        run_ids: The runs to (potentially) fix
    """
conn
ConnectionPlus
The connection to the database
The connection to the database
run_ids
Sequence[int]
The runs to (potentially) fix
The runs to ( potentially ) fix