def post(self, *args, **kwargs):
        self.preflight()

        # extract the sessionid from the path.
        sessionid = args[0]

        if not self.api_key.can_manage(sessionid):
            raise HTTPError(403)

        self.set_header('Content-Type', 'application/json')
        try:
            name, cmd, settings = self.fetch_body()
        except ValueError:
            self.set_status(400)
            return self.write({"error": "bad_request"})
            return

        # do we start the job once the config is loaded? True by default.
        if "start" in settings:
            start = settings.pop("start")
        else:
            start = True

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

        # load the config
        m = self.settings.get('manager')
        try:
            m.load(config, sessionid=sessionid, start=start)
        except ProcessError as e :
            self.set_status(e.errno)
            return self.write(e.to_dict())

        self.write({"ok": True})
dataset/ETHPy150Open benoitc/gaffer/gaffer/gafferd/http_handlers/jobs.py/JobsHandler.post/original