dianfu commented on a change in pull request #11448: [FLINK-16666][python][table] Support new Python dependency configuration options in flink-table. URL: https://github.com/apache/flink/pull/11448#discussion_r405241489
########## File path: flink-python/src/main/java/org/apache/flink/python/util/PythonDependencyUtils.java ########## @@ -0,0 +1,253 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.python.util; + +import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.api.common.cache.DistributedCache; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.configuration.ConfigOption; +import org.apache.flink.configuration.ConfigOptions; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.configuration.ReadableConfig; +import org.apache.flink.python.PythonOptions; +import org.apache.flink.util.Preconditions; +import org.apache.flink.util.StringUtils; + +import javax.annotation.Nullable; + +import java.io.File; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.apache.flink.python.PythonOptions.PYTHON_CLIENT_EXECUTABLE; +import static org.apache.flink.python.PythonOptions.PYTHON_EXECUTABLE; + +/** + * Utility class for Python dependency management. The dependencies will be registered at the distributed + * cache. + */ +public class PythonDependencyUtils { + + public static final String FILE = "file"; + public static final String CACHE = "cache"; + public static final String FILE_DELIMITER = ","; + public static final String PARAM_DELIMITER = "#"; + private static final String HASH_ALGORITHM = "SHA-256"; + + // Internal Python Config Options. + + public static final ConfigOption<Map<String, String>> PYTHON_FILES = + ConfigOptions.key("python.internal.files-key-map").mapType().noDefaultValue(); + public static final ConfigOption<Map<String, String>> PYTHON_REQUIREMENTS_FILE = + ConfigOptions.key("python.internal.requirements-file-key").mapType().noDefaultValue(); + public static final ConfigOption<Map<String, String>> PYTHON_ARCHIVES = + ConfigOptions.key("python.internal.archives-key-map").mapType().noDefaultValue(); + + public static Configuration configurePythonDependencies( Review comment: Add Java docs about this method? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
