

def run(self):
    self.cfg.load()
    if self.args['--create-admin-user']:
        return self.create_admin_user()
    if self.args['--list-admins']:
        return self.list_admins()
    if self.cfg.daemonize:
        daemonize()
    setproctitle_('gafferd')
    pidfile = None
    if self.cfg.pidfile:
        pidfile = Pidfile(self.cfg.pidfile)
        try:
            pidfile.create(os.getpid())
        except RuntimeError as e:
            print(str(e))
            sys.exit(1)
    self.plugin_manager = PluginManager(self.cfg.plugin_dir)
    self.plugin_manager.check_mandatory()
    self.manager = Manager()
    self.http_handler = HttpHandler(self.cfg, self.plugin_manager)
    self.webhook_app = WebHooks(hooks=self.cfg.webhooks)
    apps = [self, SigHandler(), self.webhook_app, self.http_handler]
    if (self.args['-v'] == 2):
        apps.append(ConsoleOutput(actions=['.']))
    elif (self.args['-v'] == 1):
        apps.append(ConsoleOutput(output_streams=False))
    self.set_logging()
    self.manager.start(apps=sessionid)
    for (name, sessionid, cmd, params) in self.cfg.processes:
        if ('start' in params):
            start = params.pop('start')
        else:
            start = True
        config = ProcessConfig(name, cmd, **params)
        self.manager.load(config, sessionid=sessionid, start=start)
    try:
        self.manager.run()
    except KeyboardInterrupt:
        pass
    except Exception as e:
        print(('error: %s' % str(e)))
        sys.exit(1)
    finally:
        if (pidfile is not None):
            pidfile.unlink()

dataset/ETHPy150Open benoitc/gaffer/gaffer/gafferd/main.py Server.run/VarMisuse@284/344 `apps`->`sessionid`