@PublicEvolving public class FunctionContext extends Object
FunctionContext
allows to obtain global runtime information about the context in which
the user-defined function is executed.
The information includes the metric group, distributed cache files, and global job parameters.
Constructor and Description |
---|
FunctionContext(RuntimeContext context)
Wraps the underlying
RuntimeContext . |
Modifier and Type | Method and Description |
---|---|
File |
getCachedFile(String name)
Gets the local temporary file copy of a distributed cache files.
|
Set<ExternalResourceInfo> |
getExternalResourceInfos(String resourceName)
Get the external resource information.
|
String |
getJobParameter(String key,
String defaultValue)
Gets the global job parameter value associated with the given key as a string.
|
MetricGroup |
getMetricGroup()
Returns the metric group for this parallel subtask.
|
public FunctionContext(RuntimeContext context)
RuntimeContext
.context
- the runtime context in which Flink's Function
is executed.public MetricGroup getMetricGroup()
public File getCachedFile(String name)
name
- distributed cache file namepublic String getJobParameter(String key, String defaultValue)
key
- key pointing to the associated valuedefaultValue
- default value which is returned in case global job parameter is null or
there is no value associated with the given keypublic Set<ExternalResourceInfo> getExternalResourceInfos(String resourceName)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.