def on_put(self, req, resp, worker_id, validated_body): """ updates a worker's status """ #load validated json payload in body body = validated_body['worker_status'] #find the worker in db worker_dict = self.db.find_one('worker', {'worker_id': worker_id}) if not worker_dict: _worker_not_found() worker = Worker(**worker_dict) if 'status' in body: worker.status = body['status'] if 'system_info' in body: worker.system_info = SystemInfo(**body['system_info']) self.db.update('worker', worker.format_for_save()) resp.status = falcon.HTTP_200