Search in sources :

Example 1 with ProgramContext

use of io.cdap.cdap.data.ProgramContext in project cdap by caskdata.

the class LineageWriterDatasetFramework method doWriteLineage.

private void doWriteLineage(DatasetId datasetInstanceId, AccessType accessType) {
    ProgramContext programContext = this.programContext;
    if (programContext != null) {
        ProgramRunId programRunId = programContext.getProgramRunId();
        NamespacedEntityId componentId = programContext.getComponentId();
        try {
            lineageWriter.addAccess(programRunId, datasetInstanceId, accessType, componentId);
        } catch (Throwable t) {
            // Failure to write to lineage shouldn't cause dataset operation failure
            LOG.warn("Failed to write lineage information for dataset {} with access type {} from {},{}", datasetInstanceId, accessType, programRunId, componentId);
            // Log the stacktrace as debug to not polluting the log
            LOG.debug("Cause for lineage writing failure for {} {} {} {}", datasetInstanceId, accessType, programRunId, componentId, t);
        }
    }
}
Also used : NamespacedEntityId(io.cdap.cdap.proto.id.NamespacedEntityId) ProgramRunId(io.cdap.cdap.proto.id.ProgramRunId) ProgramContext(io.cdap.cdap.data.ProgramContext)

Aggregations

ProgramContext (io.cdap.cdap.data.ProgramContext)1 NamespacedEntityId (io.cdap.cdap.proto.id.NamespacedEntityId)1 ProgramRunId (io.cdap.cdap.proto.id.ProgramRunId)1