code: def handle(self):
      
      spec = model.MapreduceSpec.from_json_str(
          self.request.get("mapreduce_spec"))
      state, control = db.get([
          model.MapreduceState.get_key_by_job_id(spec.mapreduce_id),
          model.MapreduceControl.get_key_by_job_id(spec.mapreduce_id),
      ])
  
      if not state:
        logging.warning("State not found for MR '%s'; dropping controller task.",
                        spec.mapreduce_id)
        return
      if not state.active:
        logging.warning(
            "MR %r is not active. Looks like spurious controller task execution.",
            spec.mapreduce_id)
        self._clean_up_mr(spec)
        return
  
      shard_states = model.ShardState.find_all_by_mapreduce_state(state)
      self._update_state_from_shard_states(state, shard_states, control)
  
      if state.active:
        ControllerCallbackHandler.reschedule(
            state, spec, self.serial_id() + 1)
docs: Handle request.