mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-21 08:21:40 +00:00
Add Pipeline Status to Ingestion Pipeline Index (#15918)
This commit is contained in:
parent
6349adb0ec
commit
c7e03471a1
@ -325,7 +325,6 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
||||
* operations. It is also used during PUT and PATCH operations to set up fields that can be updated.
|
||||
*/
|
||||
protected abstract void clearFields(T entity, Fields fields);
|
||||
;
|
||||
|
||||
/**
|
||||
* This method is used for validating an entity to be created during POST, PUT, and PATCH operations and prepare the
|
||||
|
@ -84,6 +84,10 @@ public class IngestionPipelineRepository extends EntityRepository<IngestionPipel
|
||||
if (ingestionPipeline.getService() == null) {
|
||||
ingestionPipeline.withService(getContainer(ingestionPipeline.getId()));
|
||||
}
|
||||
ingestionPipeline.setPipelineStatuses(
|
||||
fields.contains("pipelineStatuses")
|
||||
? getLatestPipelineStatus(ingestionPipeline)
|
||||
: ingestionPipeline.getPipelineStatuses());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -188,7 +192,7 @@ public class IngestionPipelineRepository extends EntityRepository<IngestionPipel
|
||||
public RestUtil.PutResponse<?> addPipelineStatus(
|
||||
UriInfo uriInfo, String fqn, PipelineStatus pipelineStatus) {
|
||||
// Validate the request content
|
||||
IngestionPipeline ingestionPipeline = findByName(fqn, Include.NON_DELETED);
|
||||
IngestionPipeline ingestionPipeline = getByName(uriInfo, fqn, getFields("service"));
|
||||
PipelineStatus storedPipelineStatus =
|
||||
JsonUtils.readValue(
|
||||
daoCollection
|
||||
@ -220,6 +224,11 @@ public class IngestionPipelineRepository extends EntityRepository<IngestionPipel
|
||||
ChangeDescription change =
|
||||
addPipelineStatusChangeDescription(
|
||||
ingestionPipeline.getVersion(), pipelineStatus, storedPipelineStatus);
|
||||
ingestionPipeline.setPipelineStatuses(pipelineStatus);
|
||||
|
||||
// Update ES Indexes
|
||||
searchRepository.updateEntity(ingestionPipeline);
|
||||
|
||||
ChangeEvent changeEvent =
|
||||
getChangeEvent(
|
||||
withHref(uriInfo, ingestionPipeline),
|
||||
|
@ -1,9 +1,10 @@
|
||||
package org.openmetadata.service.search.indexes;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.openmetadata.common.utils.CommonUtil;
|
||||
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.search.ParseTags;
|
||||
@ -30,7 +31,13 @@ public class IngestionPipelineIndex implements SearchIndex {
|
||||
suggest.add(
|
||||
SearchSuggest.builder().input(ingestionPipeline.getDisplayName()).weight(10).build());
|
||||
serviceSuggest.add(
|
||||
SearchSuggest.builder().input(ingestionPipeline.getService().getName()).weight(5).build());
|
||||
SearchSuggest.builder()
|
||||
.input(
|
||||
(ingestionPipeline.getService() != null
|
||||
? ingestionPipeline.getService().getName()
|
||||
: null))
|
||||
.weight(5)
|
||||
.build());
|
||||
ParseTags parseTags =
|
||||
new ParseTags(Entity.getEntityTags(Entity.INGESTION_PIPELINE, ingestionPipeline));
|
||||
doc.put(
|
||||
@ -51,7 +58,7 @@ public class IngestionPipelineIndex implements SearchIndex {
|
||||
doc.put("entityType", Entity.INGESTION_PIPELINE);
|
||||
doc.put(
|
||||
"totalVotes",
|
||||
CommonUtil.nullOrEmpty(ingestionPipeline.getVotes())
|
||||
nullOrEmpty(ingestionPipeline.getVotes())
|
||||
? 0
|
||||
: ingestionPipeline.getVotes().getUpVotes()
|
||||
- ingestionPipeline.getVotes().getDownVotes());
|
||||
|
Loading…
x
Reference in New Issue
Block a user