Source:
<code>public void open(PythonConfig config) throws Exception { this.bundleStarted = false; this.resultBuffer = new LinkedBlockingQueue<>(); environmentManager.open(); PortablePipelineOptions portableOptions = PipelineOptionsFactory.as(PortablePipelineOptions.class); if (jobOptions.containsKey(PythonOptions.STATE_CACHE_SIZE.key())) { portableOptions.as(ExperimentalOptions.class).setExperiments( Collections.singletonList( ExperimentalOptions.STATE_CACHE_SIZE + "=" + jobOptions.get(PythonOptions.STATE_CACHE_SIZE.key()))); } Struct pipelineOptions = PipelineOptionsTranslation.toProto(portableOptions); if (memoryManager != null && config.isUsingManagedMemory()) { <START> Preconditions.checkArgument(managedMemoryFraction > 0 && managedMemoryFraction <= 1.0, <END> "The configured managed memory fraction for Python worker process must be within (0, 1], was: %s. " + "Please refer to the config option \"taskmanager.memory.managed.consumer-weights\" for more details.", managedMemoryFraction); final LongFunctionWithException<PythonSharedResources, Exception> initializer = (size) -> new PythonSharedResources(createJobBundleFactory(pipelineOptions), createPythonExecutionEnvironment(size)); sharedResources = memoryManager.getSharedMemoryResourceForManagedMemory(MANAGED_MEMORY_RESOURCE_ID, initializer, managedMemoryFraction); LOG.info("Obtained shared Python process of size bytes", sharedResources.getSize()); sharedResources.getResourceHandle().addPythonEnvironmentManager(environmentManager); JobBundleFactory jobBundleFactory = sharedResources.getResourceHandle().getJobBundleFactory(); RunnerApi.Environment environment = sharedResources.getResourceHandle().getEnvironment(); stageBundleFactory = createStageBundleFactory(jobBundleFactory, environment); } else { jobBundleFactory = createJobBundleFactory(pipelineOptions); stageBundleFactory = createStageBundleFactory(jobBundleFactory, createPythonExecutionEnvironment(-1)); } progressHandler = getProgressHandler(flinkMetricContainer); }</code><technical_language>ask users check consumer-weights for PYTHON is set 0, is wrong python UDF is used? I is case check fails</technical_language>

Target:
public void open(PythonConfig config) throws Exception { this.bundleStarted = false; this.resultBuffer = new LinkedBlockingQueue<>(); environmentManager.open(); PortablePipelineOptions portableOptions = PipelineOptionsFactory.as(PortablePipelineOptions.class); if (jobOptions.containsKey(PythonOptions.STATE_CACHE_SIZE.key())) { portableOptions.as(ExperimentalOptions.class).setExperiments( Collections.singletonList( ExperimentalOptions.STATE_CACHE_SIZE + "=" + jobOptions.get(PythonOptions.STATE_CACHE_SIZE.key()))); } Struct pipelineOptions = PipelineOptionsTranslation.toProto(portableOptions); if (memoryManager != null && config.isUsingManagedMemory()) { Preconditions.checkArgument(managedMemoryFraction > 0 && managedMemoryFraction <= 1.0, "The configured managed memory fraction for Python worker process must be within (0, 1], was: %s. " + "It may be because the consumer type \"Python\" was missing or set to 0 for the config option \"taskmanager.memory.managed.consumer-weights\"." + managedMemoryFraction); final LongFunctionWithException<PythonSharedResources, Exception> initializer = (size) -> new PythonSharedResources(createJobBundleFactory(pipelineOptions), createPythonExecutionEnvironment(size)); sharedResources = memoryManager.getSharedMemoryResourceForManagedMemory(MANAGED_MEMORY_RESOURCE_ID, initializer, managedMemoryFraction); LOG.info("Obtained shared Python process of size bytes", sharedResources.getSize()); sharedResources.getResourceHandle().addPythonEnvironmentManager(environmentManager); JobBundleFactory jobBundleFactory = sharedResources.getResourceHandle().getJobBundleFactory(); RunnerApi.Environment environment = sharedResources.getResourceHandle().getEnvironment(); stageBundleFactory = createStageBundleFactory(jobBundleFactory, environment); } else { jobBundleFactory = createJobBundleFactory(pipelineOptions); stageBundleFactory = createStageBundleFactory(jobBundleFactory, createPythonExecutionEnvironment(-1)); } progressHandler = getProgressHandler(flinkMetricContainer); }