def put(self, *args):
        self.preflight()
        self.set_header('Content-Type', 'application/json')
        m = self.settings.get('manager')
        sessionid = args[0]
        name = args[1]

        if not self.api_key.can_manage("%s.%s" % (sessionid, name)):
            raise HTTPError(403)

        try:
            cmd, settings = self.fetch_body(name)
        except ValueError as e:
            self.set_status(400)
            return self.write({"error": "bad_request", "reason": str(e)})

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

        # create config object
        config = ProcessConfig(name, cmd, **settings)

        try:
            m.update(config, sessionid=sessionid, start=start)
        except ProcessError as e:
            self.set_status(e.errno)
            return self.write(e.to_dict())

        self.set_status(201)
        self.write({"ok": True})
dataset/ETHPy150Open benoitc/gaffer/gaffer/gafferd/http_handlers/jobs.py/JobHandler.put/original