Project

General

Profile

« Previous | Next » 

Revision 5213

tnrs_db: Added wait option to have tnrs_db exit as soon as no more names are available. This is useful for running tnrs_db when there is no concurrent import running, and therefore no need to wait for new data.

View differences:

tnrs_db
31 31
    env_names = []
32 32
    db_config = opts.get_env_vars(sql.db_config_names, None, env_names)
33 33
    verbosity = float(opts.get_env_var('verbosity', 3, env_names))
34
    wait = opts.env_flag('wait', True, env_names)
34 35
    if not 'engine' in db_config: raise SystemExit('Usage: '
35 36
        +opts.env_usage(env_names)+' '+sys.argv[0]+' 2>>log')
36 37
    
......
57 58
            limit=tnrs.max_names, cacheable=False)
58 59
        this_ct = cur.rowcount
59 60
        if this_ct == 0:
61
            if not wait: break
60 62
            log('Waited '+str(total_pause)+' sec total')
61 63
            total_pause += pause
62 64
            if total_pause > max_pause: break

Also available in: Unified diff