...
Note: Currently, reading metadata is not supported in a program or a plugin running in a cloud environment. However, metadata can still be added, updated or deleted in this case.
Programs
Metadata can be accessed from MapReduce, Spark, Workers and Service through methods from the MetadataReader object, which are available via the appropriate program context object in your program. The program context object can be obtained by invoking the getContext()
method inside the initialize
method of your program.
...
Code Block |
---|
@Override public void initialize() throws Exception { MapReduceContext context = getContext(); // construct the metadata entity MetadataEntity entity = MetadataEntity.builder().append(MetadataEntity.NAMESPACE, "myNamespace") .appendAsType(MetadataEntity.DATASET, "myDataset").build(); // add a tag context.addTags(entity, "someTag"); } |
Plugins
Metadata can be accessed from a Plugin through methods from the MetadataReader object, which are available via the appropriate context provided to in prepareRun
stage.
...