private Pair<ContainerPlacementMessage.StatusCode, String> validatePlacementAction(ContainerPlacementRequestMessage requestMessage) {
    String errorMessagePrefix = ContainerPlacementMessage.StatusCode.BAD_REQUEST + " reason: %s";
    Boolean invalidAction = false;
    String errorMessage = null;

    boolean isRunning = samzaApplicationState.runningProcessors.containsKey(requestMessage.getProcessorId());
    boolean isPending = samzaApplicationState.pendingProcessors.containsKey(requestMessage.getProcessorId());
    boolean isFailed = samzaApplicationState.failedProcessors.containsKey(requestMessage.getProcessorId());

    if (!isRunning && !isPending && !isFailed) {
      errorMessage = String.format(errorMessagePrefix, "invalid processor id neither in running, pending or failed processors");
      invalidAction = true;
    } else if (placementRequestsCache.containsKey(requestMessage.getUuid())) {
      errorMessage = String.format(errorMessagePrefix, "duplicate UUID of the request, please retry");
      invalidAction = true;
    } else if (standbyContainerManager.isPresent() && !standbyContainerManager.get()
        .checkStandbyConstraints(requestMessage.getProcessorId(), requestMessage.getDestinationHost())) {
      errorMessage = String.format(errorMessagePrefix, "destination host does not meet standby constraints");
      invalidAction = true;
    }

    if (invalidAction) {
      return new ImmutablePair<>(ContainerPlacementMessage.StatusCode.BAD_REQUEST, errorMessage);
    }

    return new ImmutablePair<>(ContainerPlacementMessage.StatusCode.ACCEPTED, "Request is accepted");
  }
A valid container placement action needs a valid processor id. Duplicate actions are handled by de-duping on uuid.
If standby containers are enabled destination host requested must meet standby constraints

@param requestMessage container placement request message
@return Pair<ContainerPlacementMessage.StatusCode, String> which is status code & response suggesting if the request is valid
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerManager.java