def run(self):
        # load config
        self.cfg.load()

        # check if we need to create an admin
        if self.args['--create-admin-user']:
            return self.create_admin_user()

        # list admin
        if self.args['--list-admins']:
            return self.list_admins()


        # do we need to daemonize the daemon
        if self.cfg.daemonize:
            daemonize()

        # fix the process name
        setproctitle_("gafferd")

        # setup the pidfile
        pidfile = None
        if self.cfg.pidfile:
            pidfile = Pidfile(self.cfg.pidfile)
            try:
                pidfile.create(os.getpid())
            except __HOLE__ as e:
                print(str(e))
                sys.exit(1)

        # initialize the plugin manager
        self.plugin_manager = PluginManager(self.cfg.plugin_dir)

        # check if any plugin dependancy is missing
        self.plugin_manager.check_mandatory()

        # initialize the manager
        self.manager = Manager()

        # initialize apps
        self.http_handler = HttpHandler(self.cfg, self.plugin_manager)
        self.webhook_app = WebHooks(hooks=self.cfg.webhooks)

        # setup gaffer apps
        apps = [self,
                SigHandler(),
                self.webhook_app,
                self.http_handler]

        # verbose mode
        if self.args["-v"] == 2:
            apps.append(ConsoleOutput(actions=['.']))
        elif self.args["-v"] == 1:
            apps.append(ConsoleOutput(output_streams=False))

        self.set_logging()

        # really start the server
        self.manager.start(apps=apps)

        # load job configs
        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)

        # run the main loop
        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