Schedule knowledge graph indexing

What does this MR do and why?

Schedules knowledge graph indexing

  • when a default branch is updated, a graph indexing task is created
  • it adds two services:
    • IndexingTaskService - responsible for creating a new indexing task on one of replicas
    • ProvisionService - responsible for creating required number of replicas on most suitable nodes. "replica" == represents a copy of graph for a namespace on a zoekt node
  • if there is no knowledge graph replica yet, a new one is created. Only one replica is created by default (the plan is to copy over update graph between replicas which will be done when graph db is created)
  • a zoekt node with biggest available space is used for the new replica
  • if there is already an indexing tasks (in pending status) for the namespace, we skip adding another one

References

Related to #540850 (closed)

How to set up and validate locally

  1. In rails console enable the KG indexing
    Feature.enable(:knowledge_graph_indexing)
  2. Test creation of indexing tasks for a project:
    ns = Project.find(7).project_namespace
    ::Ai::KnowledgeGraph::IndexingTaskService.new(ns.id, :index_graph_repo).execute

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jan Provaznik

Merge request reports

Loading