ingestion-orchestration
БесплатноБез исполняемых скриптовНе проверенProduction ingestion pipelines with Airflow, Prefect 3, Dagster. DAG design for RAG: extract -> parse -> chunk -> embed -> index. Retry policies, idempotency…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Ingestion Orchestration
Pipeline Stages
[Source] -> [Extract] -> [Parse] -> [Chunk] -> [Contextualize?] -> [Embed] -> [Upsert] -> [Validate]
| |
+-- side: lineage + metrics --+
Every stage must be:
- Idempotent — rerunning on the same input produces the same output.
- Retriable — transient failures recovered automatically.
- Observable — counts, durations, error rates per stage.
- Partitioned — a failing partition does not block the others.
Idempotency via Content Hash
import hashlib
def content_hash(text: str) -> str:
return hashlib.sha256(text.encode()).hexdigest()
def needs_processing(chunk_id: str, new_hash: str, state_store) -> bool:
existing = state_store.get(chunk_id)
return existing != new_hash
Store (chunk_id, content_hash, last_indexed_at) in a durable state table. Skip stages when the hash is unchanged.
Prefect 3 Example
Prefect 3's task runner handles retries, concurrency, and observability natively.
from prefect import flow, task, get_run_logger
from prefect.tasks import task_input_hash
from datetime import timedelta
from prefect.concurrency.sync import concurrency
@task(retries=3, retry_delay_seconds=[10, 30, 120],
cache_key_fn=task_input_hash, cache_expiration=timedelta(hours=24))
def extract(source_id: str) -> list[dict]:
log = get_run_logger()
raw = source_client.fetch(source_id)
log.info(f"Extracted {len(raw)} docs from {source_id}")
return raw
@task(retries=2)
def parse(raw: list[dict]) -> list[dict]:
return [{"id": d["id"], "text": parser.clean(d["text"])} for d in raw]
@task(retries=2)
def chunk(parsed: list[dict]) -> list[dict]:
chunks = []
for doc in parsed:
for i, c in enumerate(splitter.split_text(doc["text"])):
chunks.append({"doc_id": doc["id"], "chunk_id": f"{doc['id']}::{i}",
"text": c, "hash": content_hash(c)})
return chunks
@task(retries=3, retry_delay_seconds=30)
def embed(chunks: list[dict]) -> list[dict]:
with concurrency("embedding_api", occupy=1):
vectors = embedder.embed([c["text"] for c in chunks])
for c, v in zip(chunks, vectors):
c["vector"] = v
return chunks
@task(retries=3)
def upsert(chunks: list[dict]) -> int:
to_write = [c for c in chunks if needs_processing(c["chunk_id"], c["hash"], state)]
vstore.upsert(to_write)
for c in to_write:
state.put(c["chunk_id"], c["hash"])
return len(to_write)
@task
def validate(expected_min: int, actual: int):
if actual < expected_min:
raise ValueError(f"Upserted {actual} < expected {expected_min}; halting")
@flow(name="rag-ingest", log_prints=True)
def rag_ingest(source_id: str):
raw = extract(source_id)
parsed = parse(raw)
chunks = chunk(parsed)
embedded = embed(chunks)
count = upsert(embedded)
validate(expected_min=1, actual=count)
return count
if __name__ == "__main__":
rag_ingest.deploy(
name="rag-ingest-prod",
work_pool_name="k8s-pool",
schedule={"cron": "0 */2 * * *", "timezone": "UTC"},
parameters={"source_id": "kb_main"},
)
cache_key_fn=task_input_hashskips stages when inputs are unchanged.concurrency("embedding_api")enforces provider rate limits.- Deployment schedule runs every 2 hours.
Dagster Example (asset-first, good for RAG)
Dagster models each output as a materialized asset with lineage — great fit for embedding pipelines.
from dagster import (
asset, AssetIn, AssetExecutionContext, Definitions, Output,
DailyPartitionsDefinition, RetryPolicy, MetadataValue,
)
from datetime import datetime
daily = DailyPartitionsDefinition(start_date="2025-01-01")
@asset(partitions_def=daily, retry_policy=RetryPolicy(max_retries=3, delay=30))
def raw_docs(context: AssetExecutionContext) -> list[dict]:
partition_date = context.partition_key
return source_client.fetch_since(partition_date)
@asset(ins={"raw_docs": AssetIn("raw_docs")})
def parsed_docs(raw_docs: list[dict]) -> list[dict]:
return [parser.clean(d) for d in raw_docs]
@asset(ins={"parsed_docs": AssetIn("parsed_docs")})
def chunks(parsed_docs: list[dict]) -> list[dict]:
return [c for d in parsed_docs for c in chunk_document(d)]
@asset(retry_policy=RetryPolicy(max_retries=3))
def embeddings(context: AssetExecutionContext, chunks: list[dict]) -> list[dict]:
to_embed = [c for c in chunks if state.get(c["chunk_id"]) != c["hash"]]
context.add_output_metadata({
"num_new": MetadataValue.int(len(to_embed)),
"num_skipped": MetadataValue.int(len(chunks) - len(to_embed)),
})
if not to_embed: return []
vectors = embedder.embed([c["text"] for c in to_embed])
for c, v in zip(to_embed, vectors): c["vector"] = v
return to_embed
@asset
def vector_index(embed
Установить ingestion-orchestration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditFAQ
Что делает скилл ingestion-orchestration?
Production ingestion pipelines with Airflow, Prefect 3, Dagster. DAG design for RAG: extract -> parse -> chunk -> embed -> index. Retry policies, idempotency, partial failure, monitoring, backfills, incremental vs full refresh, data lineage, upstream dependencies. Full Dagster and Prefect examples. USE WHEN: user mentions "ingestion pipeline", "Airflow RAG", "Prefect RAG", "Dagster RAG", "DAG for embeddings", "backfill embeddings", "incremental ingestion", "idempotent ingestion" DO NOT USE FOR: real-time streaming ingestion - use `cdc-streaming-ingestion`; chunking details - use `chunking-strategies`; eval - use `rag-evaluation`
Как установить скилл ingestion-orchestration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ingestion-orchestration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic