public static Optional<File> getMetadataFile(String execEnvContainerId) {
    String dir = System.getProperty(CONTAINER_METADATA_DIRECTORY_SYS_PROPERTY);
    if (dir != null) {
      String fileName = System.getenv(EnvironmentVariables.ENV_CONTAINER_METADATA_FILENAME);
      if (StringUtils.isNotBlank(fileName)) {
        if (fileName.contains(File.separator)) {
          throw new IllegalStateException(String.format("%s should not include directories, but it is %s",
              EnvironmentVariables.ENV_CONTAINER_METADATA_FILENAME, fileName));
        } else {
          return Optional.of(new File(dir, fileName));
        }
      } else {
        if (execEnvContainerId != null) {
          return Optional.of(new File(dir, String.format(CONTAINER_METADATA_FILENAME_FORMAT, execEnvContainerId)));
        }
      }
    }
    return Optional.empty();
  }
Get the {@link File} in the "samza.log.dir" for writing container metadata.
If {@link EnvironmentVariables#ENV_CONTAINER_METADATA_FILENAME} is specified, then use that as the file name.
Otherwise, the file name is {@code exec-env-container-id}.metadata. Here the {@code exec-env-container-id} refers
to the ID assigned by the cluster manager (e.g., YARN) to the container, which uniquely identifies a container's
lifecycle.
samza-core/src/main/java/org/apache/samza/config/JobConfig.java