code: private void checkMemoryRequirements(JobInProgress job)
        throws IOException {
      if (!perTaskMemoryConfigurationSetOnJT()) {
        LOG.debug("Per-Task memory configuration is not set on JT. "
            + "Not checking the job for invalid memory requirements.");
        return;
      }
  
      boolean invalidJob = false;
      String msg = "";
      long maxMemForMapTask = job.getMemoryForMapTask();
      long maxMemForReduceTask = job.getMemoryForReduceTask();
  
      if (maxMemForMapTask == JobConf.DISABLED_MEMORY_LIMIT
          || maxMemForReduceTask == JobConf.DISABLED_MEMORY_LIMIT) {
        invalidJob = true;
        msg = "Invalid job requirements.";
      }
  
      if (maxMemForMapTask > limitMaxMemForMapTasks
          || maxMemForReduceTask > limitMaxMemForReduceTasks) {
        invalidJob = true;
        msg = "Exceeds the cluster's max-memory-limit.";
      }
  
      if (invalidJob) {
        StringBuilder jobStr =
            new StringBuilder().append(job.getJobID().toString()).append("(")
                .append(maxMemForMapTask).append(" memForMapTasks ").append(
                    maxMemForReduceTask).append(" memForReduceTasks): ");
        LOG.warn(jobStr.toString() + msg);
  
        throw new IOException(jobStr.toString() + msg);
      }
    }
docs: Check the job if it has invalid requirements and throw and IOException if does have.
  
  @param job
  @throws IOException