def on_task_metainfo(self, task, config): selector = selector_map[config['select']] # Convert within to bytes (int) or percent (float) within = config.get('within') if isinstance(within, basestring) and '%' in within: within = parse_percent(within) else: within = parse_size(within) path = selector(config['paths'], within=within) if path: log.debug('Path %s selected due to (%s)' % (path, config['select'])) for entry in task.all_entries: entry[config['to_field']] = path else: task.abort('Unable to select a path based on %s' % config['select']) return
def on_task_metainfo(self, task, config): selector = selector_map[config["select"]] # Convert within to bytes (int) or percent (float) within = config.get("within") if isinstance(within, basestring) and "%" in within: within = parse_percent(within) else: within = parse_size(within) path = selector(config["paths"], within=within) if path: log.debug("Path %s selected due to (%s)" % (path, config["select"])) for entry in task.all_entries: entry[config["to_field"]] = path else: task.abort("Unable to select a path based on %s" % config["select"]) return
def on_task_metainfo(self, task, config): selector = selector_map[config['select']] # Convert within to bytes (int) or percent (float) within = config.get('within') if isinstance(within, str) and '%' in within: within = parse_percent(within) else: within = parse_size(within) path = selector(config['paths'], within=within) if path: logger.debug('Path {} selected due to ({})', path, config['select']) for entry in task.all_entries: entry[config['to_field']] = path else: task.abort('Unable to select a path based on %s' % config['select']) return