class TaskExecutorResourceUtils {

	static TaskExecutorResourceSpec resourceSpecFromConfig(Configuration config) {
		try {
			checkTaskExecutorResourceConfigSet(config);
		} catch (IllegalConfigurationException e) {
			throw new IllegalConfigurationException("Failed to create TaskExecutorResourceSpec", e);
		}
		return new TaskExecutorResourceSpec(
			new CPUResource(config.getDouble(TaskManagerOptions.CPU_CORES)),
			config.get(TaskManagerOptions.TASK_HEAP_MEMORY),
			config.get(TaskManagerOptions.TASK_OFF_HEAP_MEMORY),
			config.get(TaskManagerOptions.NETWORK_MEMORY_MIN),
			config.get(TaskManagerOptions.MANAGED_MEMORY_SIZE)
		);
	}

	private  TaskExecutorResourceUtils();

}