nemo_curator.pipeline.pipeline
nemo_curator.pipeline.pipeline
Module Contents
Classes
Functions
API
User-facing pipeline definition for composing processing stages.
String representation of the pipeline.
Decompose composite stages into execution stages.
Parameters:
List of stages that may include composite stages
Returns: tuple[list[ProcessingStage], dict[str, list[str]]]
tuple[list[ProcessingStage], dict[str, list[str]]]: Tuple of (execution stages, decomposition info dict)
Raises:
TypeError: If a composite stage is decomposed into another composite stage
Run with resumability around a pre-existing Ray cluster (e.g. one
started by RayClient).
We briefly connect with with ray.init() to spawn the detached
checkpoint actor, then disconnect before executor.execute so the
executor’s own ray.init runs un-nested — a nested
ray.init(runtime_env=...) is silently dropped, so the executor’s env
vars wouldn’t propagate otherwise. The detached actor lives in the
cluster across the executor’s separate Ray session; a final
with ray.init() closes and kills it. The cluster must pre-exist: had
we started it, the first with-exit shutdown would tear it down and
take the actor with it.
Add a stage to the pipeline.
Parameters:
Processing stage to add
Returns: Pipeline
Self (Pipeline) for method chaining
Build an execution plan from the pipeline.
Raises:
ValueError: If the pipeline has no stages
Get a detailed description of the pipeline stages and their requirements.
Run the pipeline.
Parameters:
Executor to use
Initial tasks to start the pipeline with. Defaults to None.
Resumability directory. Must
be a LOCAL filesystem path (the LMDB state is written locally),
not a remote/cloud URI. When set, completed source partitions are
tracked (in a .nemo_curator_metadata subdir) and skipped on
rerun. Multiple runs (e.g. a SLURM array) may share the directory
— each writes its own LMDB file, so there is no contention.
Returns: list[Task] | None
list[Task] | None: List of tasks
Assign root task_ids to user-provided initial tasks.
Every task in a run descends from the implicit root "0" (the id of
:class:EmptyTask). User-provided initial tasks are its direct
children, so they get "0_0", "0_1", … EmptyTask instances
are skipped (already "0"). All downstream task_id assignment
happens in BaseStageAdapter.
NOTE: we deliberately use the positional index here, NOT
get_deterministic_id(), even for content-bearing tasks like
FileGroupTask. The source stage is the single place content-based
ids are assigned (to its outputs); hashing here too would put the
content hash at two levels of the id path ("0_<hashA>_<hashB>").
Passing initial tasks directly is rare; if you need reorder-stable
source ids, let a source stage emit them.