Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/3741#discussion_r114503248
--- Diff:
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
---
@@ -1776,8 +1787,45 @@ public static void setDefaultLocalParallelism(int
parallelism) {
protected static void
initializeContextEnvironment(StreamExecutionEnvironmentFactory ctx) {
contextEnvironmentFactory = ctx;
}
-
+
protected static void resetContextEnvironment() {
contextEnvironmentFactory = null;
}
+
+ /**
+ * Registers a file at the distributed cache under the given name. The
file will be accessible
+ * from any user-defined function in the (distributed) runtime under a
local path. Files
+ * may be local files (as long as all relevant workers have access to
it), or files in a distributed file system.
+ * The runtime will copy the files temporarily to a local cache, if
needed.
+ * <p>
+ * The {@link org.apache.flink.api.common.functions.RuntimeContext} can
be obtained inside UDFs via
+ * {@link
org.apache.flink.api.common.functions.RichFunction#getRuntimeContext()} and
provides access
+ * {@link org.apache.flink.api.common.cache.DistributedCache} via
+ * {@link
org.apache.flink.api.common.functions.RuntimeContext#getDistributedCache()}.
+ *
+ * @param filePath The path of the file, as a URI (e.g.
"file:///some/path" or "hdfs://host:port/and/path")
+ * @param name The name under which the file is registered.
+ */
+ public void registerCachedFile(String filePath, String name){
+ registerCachedFile(filePath, name, false);
+ }
+
+ /**
+ * Registers a file at the distributed cache under the given name. The
file will be accessible
+ * from any user-defined function in the (distributed) runtime under a
local path. Files
+ * may be local files (as long as all relevant workers have access to
it), or files in a distributed file system.
+ * The runtime will copy the files temporarily to a local cache, if
needed.
+ * <p>
+ * The {@link org.apache.flink.api.common.functions.RuntimeContext} can
be obtained inside UDFs via
+ * {@link
org.apache.flink.api.common.functions.RichFunction#getRuntimeContext()} and
provides access
+ * {@link org.apache.flink.api.common.cache.DistributedCache} via
+ * {@link
org.apache.flink.api.common.functions.RuntimeContext#getDistributedCache()}.
+ *
+ * @param filePath The path of the file, as a URI (e.g.
"file:///some/path" or "hdfs://host:port/and/path")
+ * @param name The name under which the file is registered.
+ * @param executable flag indicating whether the file should be
executable
+ */
+ public void registerCachedFile(String filePath, String name, boolean
executable){
--- End diff --
missing space before `}`.
---
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.
---