### Navigation

- index
- modules |
- CCHR 1.0 documentation »
- Module code »
- src »

# Source code for src.cmd.compare

    from os.path import normpath, join
    from datetime import datetime

    from util import *
    from ..configuration import db_info, config

    def compare(cmd):
        if cmd.args.segments in ['summary', 'sum']:
            _segments = ['summary']
        else:
            _segments = [segment_run_map[seg] for seg in cmd.args.segments.split('|')]

        for segment in _segments:
            #set region
            if cmd.args.region:
                _region = cmd.args.region
            elif cmd.args.segments in ['summary', 'sum']:
                _region = ''
            else:
                _region = 'all'

            _log = normpath(join(config.log_dir, 'set_%i' % config.current_set, 'compare',
                                 segment, ))

            cmd.task_queue.put({
                'segment': segment,
                'region': _region,
                'set': cmd.args.set,
                'db_info': db_info['stand'],
                'verbose': cmd.args.verbose,
                'log_dir': create_log_dir(_log, replace=True)
            })

        cmd.start() #start the compare worker threads
        cmd.task_queue.join() #wait for workers to finish
        cmd.flush() #flush the logs

        print "Finished compare at %s." % (datetime.now().isoformat(' '))

### Navigation

- index
- modules |
- CCHR 1.0 documentation »
- Module code »
- src »