def do_restart(self):
        try:
            jobs_removed, webhooks_removed = self.cfg.reload()
        except ConfigError as e:
            # if on restart we fail to parse the config then just return and
            # do nothing
            logging.error("failed parsing config: %s" % str(e))
            logging.info("config not reloaded")
            return

        # remove jobs config from the manager
        for jobname, sessionid in jobs_removed:
            self.manager.unload(jobname, sessionid=sessionid)

        # load or update job configs
        for name, sessionid, cmd, params in self.cfg.processes:
            if "start" in params:
                # on restart we don't start the loaded jobs. They will be
                # handled later by gaffer so just remove this param
                params.pop("start")

            config = ProcessConfig(name, cmd, **params)

            # so we need to update a job config
            update = True
            try:
                self.manager.get("%s.%s" % (sessionid, name))
            except ProcessError:
                update = False

            if update:
                self.manager.update(config, sessionid=sessionid)
            else:
                self.manager.load(config, sessionid=sessionid)

        # unregister hooks
        for event, url in webhooks_removed:
            self.webhook_app.unregister(event, url)

        # restart plugins
        self.plugin_manager.restart_apps(self.cfg, self.manager.loop,
                self.manager)
dataset/ETHPy150Open benoitc/gaffer/gaffer/gafferd/main.py/Server.do_restart/original