(self)
return conf
Processes args dict
Processes args dict
Processes args dict
def get_config(self):
        """Processes args dict"""
        conf = ShardHandler.get_config(self)
        # set table mode
        conf.table_mode = self.get_arg('table_mode', TABLE_MODES)
        conf.analyze = self.get_arg('analyze', [0, 1])
        if conf.table_mode == 'part':
            conf.part_mode = self.get_arg('part_mode', PART_MODES)
            conf.part_field = self.args.get('part_field')
            if conf.part_mode == 'date_field' and not conf.part_field :
                raise Exception('part_mode date_field requires part_field!')
            conf.period = self.get_arg('period', PERIODS)
            conf.part_name = self.args.get('part_name')
            conf.part_template = self.args.get('part_template')
            conf.pre_part = self.args.get('pre_part')
            conf.post_part = self.args.get('post_part')
            conf.part_func = self.args.get('part_func', PART_FUNC_NEW)
            conf.retention_period = self.args.get('retention_period')
            conf.ignore_old_events = self.get_arg('ignore_old_events', [0, 1], 0)
        # set row mode and event types to process
        conf.row_mode = self.get_arg('row_mode', ROW_MODES)
        event_types = self.args.get('event_types', '*')
        if event_types == '*':
            event_types = EVENT_TYPES
        else:
            event_types = [evt.upper() for evt in event_types.split(',')]
            for evt in event_types:
                if evt not in EVENT_TYPES:
                    raise Exception('Unsupported operation: %s' % evt)
        conf.event_types = event_types
        # set load handler
        conf.load_mode = self.get_arg('load_mode', LOAD_MODES)
        conf.method = self.get_arg('method', METHODS)
        # fields to skip
        conf.skip_fields = [f.strip().lower()
                for f in self.args.get('skip_fields','').split(',')]
        # get fields map (obsolete, for compatibility reasons)
        fields = self.args.get('fields', '*')
        if  fields == "*":
            conf.field_map = None
        else:
            conf.field_map = {}
            for fval in fields.split(','):
                tmp = fval.split(':')
                if len(tmp) == 1:
                    conf.field_map[tmp[0]] = tmp[0]
                else:
                    conf.field_map[tmp[0]] = tmp[1]
        return conf
def get_config ( self ) : conf = ShardHandler . get_config ( self ) # set table mode conf . table_mode = self . get_arg ( 'table_mode' , TABLE_MODES ) conf . analyze = self . get_arg ( 'analyze' , [ 0 , 1 ] ) if conf . table_mode == 'part' : conf . part_mode = self . get_arg ( 'part_mode' , PART_MODES ) conf . part_field = self . args . get ( 'part_field' ) if conf . part_mode == 'date_field' and not conf . part_field : raise Exception ( 'part_mode date_field requires part_field!' ) conf . period = self . get_arg ( 'period' , PERIODS ) conf . part_name = self . args . get ( 'part_name' ) conf . part_template = self . args . get ( 'part_template' ) conf . pre_part = self . args . get ( 'pre_part' ) conf . post_part = self . args . get ( 'post_part' ) conf . part_func = self . args . get ( 'part_func' , PART_FUNC_NEW ) conf . retention_period = self . args . get ( 'retention_period' ) conf . ignore_old_events = self . get_arg ( 'ignore_old_events' , [ 0 , 1 ] , 0 ) # set row mode and event types to process conf . row_mode = self . get_arg ( 'row_mode' , ROW_MODES ) event_types = self . args . get ( 'event_types' , '*' ) if event_types == '*' : event_types = EVENT_TYPES else : event_types = [ evt . upper ( ) for evt in event_types . split ( ',' ) ] for evt in event_types : if evt not in EVENT_TYPES : raise Exception ( 'Unsupported operation: %s' % evt ) conf . event_types = event_types # set load handler conf . load_mode = self . get_arg ( 'load_mode' , LOAD_MODES ) conf . method = self . get_arg ( 'method' , METHODS ) # fields to skip conf . skip_fields = [ f . strip ( ) . lower ( ) for f in self . args . get ( 'skip_fields' , '' ) . split ( ',' ) ] # get fields map (obsolete, for compatibility reasons) fields = self . args . get ( 'fields' , '*' ) if fields == "*" : conf . field_map = None else : conf . field_map = { } for fval in fields . split ( ',' ) : tmp = fval . split ( ':' ) if len ( tmp ) == 1 : conf . field_map [ tmp [ 0 ] ] = tmp [ 0 ] else : conf . field_map [ tmp [ 0 ] ] = tmp [ 1 ] return conf