### Navigation

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

# Source code for src.cmd.validate_rules

    from os import path, makedirs
    from datetime import datetime

    from ..transform import get_rules
    from ..segment import segment_list
    from ..configuration import config, db_info, dir_map
    from ..util import check_file, RUNDATETIME

    def validate_rules(cmd):
        args = cmd.args
        database = db_info['stand']
        print "Validating Rules..."
        opt = {'meta_dir': check_file(args.meta_dir, as_dir = True),
               'verbose': args.verbose,
               'db_info': database,
               'phase_id':'3',
               'rules': dir_map['pre_process_rules_dir'],
               'halt_on_err': True,
               'log_dir': path.join(config.log_dir, 'set_%s' % config.current_set, 'validate_rules', RUNDATETIME)
              }
        cmd.task_queue.put(opt)

        if not path.isdir(opt['log_dir']):
            makedirs(path.normpath(opt['log_dir']))

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

        print "Rule validation complete, see rule_init.txt for more details."

### Navigation

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