use of org.apache.sysml.runtime.instructions.spark.data.LineageObject in project incubator-systemml by apache.
the class SparkExecutionContext method rCleanupLineageObject.
@SuppressWarnings({ "rawtypes", "unchecked" })
private void rCleanupLineageObject(LineageObject lob) throws IOException {
//abort recursive cleanup if still consumers
if (lob.getNumReferences() > 0)
return;
//robustness in function calls and to prevent repeated scans of the symbol table)
if (lob.hasBackReference())
return;
//incl deferred hdfs file removal (only if metadata set by cleanup call)
if (lob instanceof RDDObject) {
RDDObject rdd = (RDDObject) lob;
int rddID = rdd.getRDD().id();
cleanupRDDVariable(rdd.getRDD());
if (rdd.getHDFSFilename() != null) {
//deferred file removal
MapReduceTool.deleteFileWithMTDIfExistOnHDFS(rdd.getHDFSFilename());
}
if (rdd.isParallelizedRDD())
_parRDDs.deregisterRDD(rddID);
} else if (lob instanceof BroadcastObject) {
PartitionedBroadcast pbm = ((BroadcastObject) lob).getBroadcast();
if (//robustness for evictions
pbm != null)
for (Broadcast<PartitionedBlock> bc : pbm.getBroadcasts()) cleanupBroadcastVariable(bc);
CacheableData.addBroadcastSize(-((BroadcastObject) lob).getSize());
}
//recursively process lineage children
for (LineageObject c : lob.getLineageChilds()) {
c.decrementNumReferences();
rCleanupLineageObject(c);
}
}
Aggregations