use of io.cdap.cdap.proto.metadata.lineage.LineageRecord in project cdap by caskdata.
the class GetDatasetLineageCommand method perform.
@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
long currentTime = System.currentTimeMillis();
DatasetId dataset = cliConfig.getCurrentNamespace().dataset(arguments.get(ArgumentName.DATASET.toString()));
long start = getTimestamp(arguments.getOptional("start", "min"), currentTime);
long end = getTimestamp(arguments.getOptional("end", "max"), currentTime);
Integer levels = arguments.getIntOptional("levels", null);
LineageRecord lineage = client.getLineage(dataset, start, end, levels);
Table table = Table.builder().setHeader("start", "end", "relations", "programs", "data").setRows(Collections.<List<String>>singletonList(Lists.newArrayList(Long.toString(lineage.getStart()), Long.toString(lineage.getEnd()), GSON.toJson(lineage.getRelations()), GSON.toJson(lineage.getPrograms()), GSON.toJson(lineage.getData())))).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
Aggregations