Github user mxm commented on a diff in the pull request:
https://github.com/apache/flink/pull/1409#discussion_r45970591
--- Diff: flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java ---
@@ -221,4 +210,22 @@ public static void addToEnvironment(Map<String,
String> environment,
private Utils() {
throw new RuntimeException();
}
+
+ /**
+ * Method to extract environment variables from the flinkConfiguration
based on the given prefix String.
+ *
+ * @param envPrefix Prefix for the environment variables key
+ * @param flinkConfiguration The Flink config to get the environment
variable defintion from
+ */
+ public static Map<String, String> getEnvironmentVariables(String
envPrefix, org.apache.flink.configuration.Configuration flinkConfiguration) {
+ Map<String, String> result = new HashMap<>();
+ for(Map.Entry<String, String> entry:
flinkConfiguration.toMap().entrySet()) {
+ if(entry.getKey().startsWith(envPrefix)) {
+ // remove prefix
+ String key =
entry.getKey().substring(envPrefix.length());
--- End diff --
What happens if the key is `envPrefix`? There is little validation here.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---