public static Configuration adjustForLocalExecution(Configuration config) {
        UNUSED_CONFIG_OPTIONS.forEach(
                option -> warnAndRemoveOptionHasNoEffectIfSet(config, option));

        setConfigOptionToPassedMaxIfNotSet(
                config, TaskManagerOptions.CPU_CORES, LOCAL_EXECUTION_CPU_CORES);
        setConfigOptionToPassedMaxIfNotSet(
                config, TaskManagerOptions.TASK_HEAP_MEMORY, LOCAL_EXECUTION_TASK_MEMORY);
        setConfigOptionToPassedMaxIfNotSet(
                config, TaskManagerOptions.TASK_OFF_HEAP_MEMORY, LOCAL_EXECUTION_TASK_MEMORY);

        adjustNetworkMemoryForLocalExecution(config);
        setConfigOptionToDefaultIfNotSet(
                config, TaskManagerOptions.MANAGED_MEMORY_SIZE, DEFAULT_MANAGED_MEMORY_SIZE);

        // Set valid default values for unused config options which should have been removed.
        config.set(
                TaskManagerOptions.FRAMEWORK_HEAP_MEMORY,
                TaskManagerOptions.FRAMEWORK_HEAP_MEMORY.defaultValue());
        config.set(
                TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY,
                TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY.defaultValue());
        config.set(
                TaskManagerOptions.JVM_METASPACE, TaskManagerOptions.JVM_METASPACE.defaultValue());
        config.set(
                TaskManagerOptions.JVM_OVERHEAD_MAX,
                TaskManagerOptions.JVM_OVERHEAD_MAX.defaultValue());
        config.set(
                TaskManagerOptions.JVM_OVERHEAD_MIN,
                TaskManagerOptions.JVM_OVERHEAD_MAX.defaultValue());

        return config;
    }
@Test
    void testAdjustForLocalExecution() {
        Configuration configuration =
                TaskExecutorResourceUtils.adjustForLocalExecution(new Configuration());

        assertThat(configuration.get(TaskManagerOptions.NETWORK_MEMORY_MIN))
                .isEqualTo(TaskExecutorResourceUtils.DEFAULT_SHUFFLE_MEMORY_SIZE);
        assertThat(configuration.get(TaskManagerOptions.NETWORK_MEMORY_MAX))
                .isEqualTo(TaskExecutorResourceUtils.DEFAULT_SHUFFLE_MEMORY_SIZE);
        assertThat(configuration.get(TaskManagerOptions.MANAGED_MEMORY_SIZE))
                .isEqualTo(TaskExecutorResourceUtils.DEFAULT_MANAGED_MEMORY_SIZE);
    }