Class CrawlCleanupService
java.lang.Object
ai.pipestream.module.pipelineprobe.pipelinecrawl.CrawlCleanupService
Ninja cleanup for pipeline-crawl runs: by default a run deletes every
resource it provisioned, so an hourly health-check e2e leaves the
platform exactly as it found it. Two entry points:
cleanupRun(CrawlCleanupService.RunResources)— per-run teardown, called from the orchestrator's finally (success AND failure paths) unless the request setskip_cleanup.retain_indexkeeps the OS indices + their IndexPlan for inspection; everything else still goes.sweepLeakedRuns(boolean)— admin sweep over EVERYTHING matching thepipeline-crawl-naming convention: accounts, their drives, datasources, graphs, index plans + indices. Cleans up the backlog left by runs that predate per-run cleanup (or whose sidecar died mid-run).
Every step is best-effort with a per-step audit line — a partial
earlier failure never blocks the remaining steps, mirroring
OpenSearchTestSetupService.teardown. Deletion order is
leaf-first: plan/indices and drives before datasource before account,
so a re-run after a partial failure still finds the parents.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordEverything one run needs torn down. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringNaming-convention prefix every disposable crawl resource carries. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPer-run ninja teardown.sweepLeakedRuns(boolean dryRun) Admin sweep over every leakedpipeline-crawl-*resource.
-
Field Details
-
CRAWL_PREFIX
Naming-convention prefix every disposable crawl resource carries.- See Also:
-
-
Constructor Details
-
CrawlCleanupService
public CrawlCleanupService()Creates the crawl cleanup service. The gRPC stubs and the active-crawl registry are injected by the container; instances are managed by CDI.
-
-
Method Details
-
cleanupRun
Per-run ninja teardown. Returns a human audit of what was destroyed/kept.- Parameters:
r- the run's provisioned resources to tear down- Returns:
- an ordered, human-readable audit line per cleanup step (each step best-effort; failures are recorded rather than thrown)
-
sweepLeakedRuns
Admin sweep over every leakedpipeline-crawl-*resource. Accounts of currently-active crawls are skipped.dryRunreports what WOULD be deleted without touching anything.- Parameters:
dryRun- when true, report what would be deleted without deleting anything; when false, perform the deletions- Returns:
- an ordered, human-readable audit; if any crawl is currently active on this sidecar the sweep is refused and the audit says so
-