def __init__(self, injector=None, config_path=None): if not injector: import gransk.core.injector as _injector injector = _injector.Injector() code_root = os.path.realpath( os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) if not config_path: config_path = os.path.join(code_root, 'config.yml') with open(config_path) as inp: self.config = yaml.load(inp.read()) self.config['worker_id'] = 0 self.config['injector'] = injector self.config['injector'].set_config(self.config) self.config[helper.CODE_ROOT] = code_root self.config[helper.DATA_ROOT] = os.path.join(code_root, 'local_data') self.config[helper.WORKERS] = 1 self.config[helper.TAG] = 'default' self.config[helper.MAX_FILE_SIZE] = getattr(self.config, helper.MAX_FILE_SIZE, 0) self.config[helper.SUBSCRIBERS].extend([ 'gransk.core.detect_type' ]) self.pipeline = pipeline.build_pipeline(self.config) self.entrypoint = Subscriber(self.pipeline) self.entrypoint.setup(self.config)
def main(): """Entry point - Start processing. Reads arguments from sys.argv.""" import gransk.core.injector as injector inject = injector.Injector() run(inject, sys.argv[1:])