From 5cd320754f6b022883a815586f0b50b103114207 Mon Sep 17 00:00:00 2001 From: wslulciuc Date: Mon, 12 Dec 2022 14:58:17 -0800 Subject: [PATCH] Return orphan graph on failed lookup for job when dataset nodeID provided Signed-off-by: wslulciuc --- api/src/main/java/marquez/service/LineageService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/marquez/service/LineageService.java b/api/src/main/java/marquez/service/LineageService.java index 4219e82162..3014b32f74 100644 --- a/api/src/main/java/marquez/service/LineageService.java +++ b/api/src/main/java/marquez/service/LineageService.java @@ -53,7 +53,10 @@ public Lineage lineage(NodeId nodeId, int depth, boolean withRunFacets) { log.debug("Attempting to get lineage for node '{}' with depth '{}'", nodeId.getValue(), depth); Optional optionalUUID = getJobUuid(nodeId); if (optionalUUID.isEmpty()) { - throw new NodeIdNotFoundException(String.format("Node '%s' not found!", nodeId.getValue())); + log.warn( + "Failed to get job associated with node '{}', returning orphan graph...", + nodeId.getValue()); + return toLineageWithOrphanDataset(nodeId.asDatasetId()); } UUID job = optionalUUID.get(); log.debug("Attempting to get lineage for job '{}'", job); @@ -99,7 +102,7 @@ public Lineage lineage(NodeId nodeId, int depth, boolean withRunFacets) { if (nodeId.isDatasetType() && datasets.stream().noneMatch(n -> n.getId().equals(nodeId.asDatasetId()))) { log.warn( - "Found jobs '{}' which no longer share lineage with dataset '{}' - discarding", + "Found jobs {} which no longer share lineage with dataset '{}' - discarding", jobData.stream().map(JobData::getId).toList(), nodeId.getValue()); return toLineageWithOrphanDataset(nodeId.asDatasetId());