IngestBuilder#

class nominal.experimental.ingest.IngestBuilder(client, dataset, *, tags=None)#

Bases: object

Accumulate files and submit them as a single (MULTI) ingest job.

EXPERIMENTAL / UNSTABLE — see the module docstring. Targets an existing dataset; the v2 endpoint does not create datasets. Build with add_* (fluent), then submit() exactly once: a builder is single-use, and a second submit() raises rather than re-uploading and re-ingesting everything it holds.

Pass a DriveFileRevision wherever a source path is accepted to ingest its exact content server-side, without downloading or uploading it. Local files and revisions can share a job. Revisions must contain content; retention and access are checked by the service.

Create a builder that targets an existing dataset.

Parameters:
  • client (NominalClient)

    Client used to upload files and trigger the ingest job.

  • dataset (str | Dataset)

    The dataset to ingest into, as a Dataset or its RID. It must already exist; the v2 ingest endpoint does not create datasets.

  • tags (Mapping[str, str] | None)

    Request-level tags applied to every item in the job. Add more later with add_tags, or set per-item tags on the individual add_* calls.

add_ardupilot_dataflash(path, *, tags=None)#

Register an ArduPilot Dataflash (.bin) file, mirroring Dataset.add_ardupilot_dataflash.

Parameters:
Returns:

This builder, for chaining.

Return type:

Self

add_avro_stream(path, *, units=None, channel_prefix=None, timestamp_type=None, tags=None)#

Register an Avro stream (.avro) file.

The file must conform to the canonical Avro stream schema (see Dataset.add_avro_stream for the schema definition). The schema fixes which field holds the timestamps, so this takes no timestamp column – only how to read the numbers in that field.

Parameters:
  • path (Path | str | DriveFileRevision)

    Local .avro path or Drive revision with an .avro path.

  • units (Mapping[str, str] | None)

    Mapping of channel name to unit symbol.

  • channel_prefix (str | None)

    Prefix prepended to every channel name ingested from this file.

  • timestamp_type (Epoch | Relative | Literal['epoch_picoseconds', 'epoch_nanoseconds', 'epoch_microseconds', 'epoch_milliseconds', 'epoch_seconds', 'epoch_minutes', 'epoch_hours', 'epoch_days'] | None)

    How to read the file’s numeric timestamps – an absolute epoch (ts.Epoch, or its string literal) or an offset from a start (ts.Relative). Defaults to epoch nanoseconds, the canonical schema’s reading.

  • tags (Mapping[str, str] | None)

    Key-value pairs applied as tags to all data from this file. Tags in the records take precedence – these only fill keys a record does not already set.

Returns:

This builder, for chaining.

Return type:

Self

add_containerized(extractor: str | ContainerizedExtractor, sources: Mapping[str, Path | str | DriveFileRevision], *, arguments: Mapping[str, str] | None = None, tags: Mapping[str, str] | None = None) → Self#
add_containerized(extractor: str | ContainerizedExtractor, sources: Mapping[str, Path | str | DriveFileRevision], *, arguments: Mapping[str, str] | None = None, timestamp_column: str, timestamp_type: Iso8601 | Epoch | Relative | Custom | Literal['iso_8601', 'epoch_picoseconds', 'epoch_nanoseconds', 'epoch_microseconds', 'epoch_milliseconds', 'epoch_seconds', 'epoch_minutes', 'epoch_hours', 'epoch_days'], tags: Mapping[str, str] | None = None) → Self

Register a containerized-extractor run over one or more named source files.

Pass both timestamp_column and timestamp_type, or neither; the overloads make passing only one a type error, and the runtime guard below rejects it for callers without a type checker.

Parameters:
  • extractor (str | ContainerizedExtractor)

    The containerized extractor to run, as a ContainerizedExtractor or its RID.

  • sources (Mapping[str, Path | str | DriveFileRevision])

    Mapping of each registered extractor input name to a local file or Drive revision. The names must match the extractor’s registered inputs exactly.

  • arguments (Mapping[str, str] | None)

    Key-value input arguments passed to the extractor.

  • timestamp_column (str | None)

    Column, applied uniformly to the extractor’s output files, holding each row’s timestamp.

  • timestamp_type (Iso8601 | Epoch | Relative | Custom | Literal['iso_8601', 'epoch_picoseconds', 'epoch_nanoseconds', 'epoch_microseconds', 'epoch_milliseconds', 'epoch_seconds', 'epoch_minutes', 'epoch_hours', 'epoch_days'] | None)

    Type of the timestamp data in timestamp_column, e.g. ‘epoch_seconds’.

  • tags (Mapping[str, str] | None)

    Key-value pairs applied as tags to all data produced by this run.

Returns:

This builder, for chaining.

Raises:

ValueError – if sources is empty, or if only one of timestamp_column / timestamp_type is given.

Return type:

Self

add_csv(path, timestamp_column, timestamp_type, *, tag_columns=None, units=None, channel_prefix=None, channel_name_overrides=None, header_row=None, data_row=None, units_row=None, tags=None)#

Register a CSV file (.csv or .csv.gz) with optional row selection.

All shared arguments follow add_tabular_data(). Explicit units override units read from units_row per channel; other channels retain their row units. The backend validates row numbers and their ordering when the job is submitted.

Parameters:
  • path (Path | str | DriveFileRevision)

    Local .csv or .csv.gz path, or a Drive revision with that extension.

  • timestamp_column (str)

    Column containing timestamps; not ingested as a data channel.

  • timestamp_type (Iso8601 | Epoch | Relative | Custom | Literal['iso_8601', 'epoch_picoseconds', 'epoch_nanoseconds', 'epoch_microseconds', 'epoch_milliseconds', 'epoch_seconds', 'epoch_minutes', 'epoch_hours', 'epoch_days'])

    Type of the timestamp data, e.g. ‘epoch_seconds’.

  • tag_columns (Mapping[str, str] | None)

    Mapping of tag keys to columns supplying their values.

  • units (Mapping[str, str] | None)

    Mapping of channel names to unit symbols, overriding the units record per channel.

  • channel_prefix (str | None)

    Prefix prepended to every ingested channel name.

  • channel_name_overrides (Mapping[str, str] | None)

    Mapping of original channel names to their ingested names.

  • tags (Mapping[str, str] | None)

    Key-value pairs applied as tags to all data from this file.

  • header_row (int | None)

    Positive, one-based header record number, defaulting to 1. Blank lines are ignored; a multiline record counts as one record.

  • data_row (int | None)

    Positive, one-based first data record, defaulting to header_row + 1. Must follow the header; intervening records are skipped.

  • units_row (int | None)

    Positive, one-based units record, distinct from the header and before the first data record. Set data_row past it. Unit cells match columns by position, including a placeholder for the timestamp column. Empty cells have no unit. Omit to read no units row.

Returns:

This builder, for chaining.

Raises:

ValueError – The path is not CSV.

Return type:

Self

add_journal_json(path: Path | str | DriveFileRevision, *, channel: str | None = None, tags: Mapping[str, str] | None = None) → Self#
add_journal_json(path: Path | str | DriveFileRevision, *, channel: str | None = None, timestamp_column: str, timestamp_type: Epoch | Relative | Literal['epoch_picoseconds', 'epoch_nanoseconds', 'epoch_microseconds', 'epoch_milliseconds', 'epoch_seconds', 'epoch_minutes', 'epoch_hours', 'epoch_days'], tags: Mapping[str, str] | None = None) → Self

Register a journald-style .jsonl / .jsonl.gz log file.

Pass both timestamp_column and timestamp_type, or neither; the overloads make passing only one a type error, and the runtime guard below rejects it for callers without a type checker.

Parameters:
  • path (Path | str | DriveFileRevision)

    Local journal-json path or Drive revision.

  • channel (str | None)

    Channel name to ingest the logs under. Defaults to ‘logs’ if omitted.

  • timestamp_column (str | None)

    Field holding each record’s timestamp. Omit to use the file’s default journald timestamp.

  • timestamp_type (Epoch | Relative | Literal['epoch_picoseconds', 'epoch_nanoseconds', 'epoch_microseconds', 'epoch_milliseconds', 'epoch_seconds', 'epoch_minutes', 'epoch_hours', 'epoch_days'] | None)

    How to read the numbers in timestamp_column – an absolute epoch (ts.Epoch, or its string literal, e.g. ‘epoch_microseconds’) or an offset from a start (ts.Relative). Log timestamps are read as numbers, so ISO 8601 and custom string formats cannot be used here.

  • tags (Mapping[str, str] | None)

    Key-value pairs applied as tags to all data from this file.

Returns:

This builder, for chaining.

Raises:

ValueError – if only one of timestamp_column / timestamp_type is given, or if timestamp_type is not numeric.

Return type:

Self

add_mcap(path: Path | str | DriveFileRevision, *, include_topics: Sequence[str] | None = None, ignore_invalid_topics: bool | None = None, tags: Mapping[str, str] | None = None) → Self#
add_mcap(path: Path | str | DriveFileRevision, *, exclude_topics: Sequence[str] | None = None, ignore_invalid_topics: bool | None = None, tags: Mapping[str, str] | None = None) → Self

Register an MCAP file.

Pass at most one of include_topics / exclude_topics; the overloads make passing both a type error, and the runtime guard below rejects it for callers without a type checker.

Parameters:
  • path (Path | str | DriveFileRevision)

    Local MCAP path or Drive revision.

  • include_topics (Sequence[str] | None)

    If given, restrict ingestion to these topics. Defaults to all protobuf-encoded topics present in the MCAP.

  • exclude_topics (Sequence[str] | None)

    If given, ingest every topic except these.

  • ignore_invalid_topics (bool | None)

    If true, skip invalid MCAP topics and continue ingesting valid ones.

  • tags (Mapping[str, str] | None)

    Key-value pairs applied as tags to all data from this file.

Returns:

This builder, for chaining.

Raises:

ValueError – if both include_topics and exclude_topics are given.

Return type:

Self

add_parquet(path, timestamp_column, timestamp_type, *, tag_columns=None, units=None, channel_prefix=None, channel_name_overrides=None, tags=None)#

Register a Parquet file or archive, inferring compression and archive format from its extension.

Supports .parquet, .parquet.gz, .parquet.tar, .parquet.tar.gz, and .parquet.zip.

Parameters:
  • path (Path | str | DriveFileRevision)

    Local Parquet file or archive path, or a Drive revision with that extension.

  • timestamp_column (str)

    Column containing timestamps; not ingested as a data channel.

  • timestamp_type (Iso8601 | Epoch | Relative | Custom | Literal['iso_8601', 'epoch_picoseconds', 'epoch_nanoseconds', 'epoch_microseconds', 'epoch_milliseconds', 'epoch_seconds', 'epoch_minutes', 'epoch_hours', 'epoch_days'])

    Type of the timestamp data, e.g. ‘epoch_seconds’.

  • tag_columns (Mapping[str, str] | None)

    Mapping of tag keys to columns supplying their values.

  • units (Mapping[str, str] | None)

    Mapping of channel names to unit symbols.

  • channel_prefix (str | None)

    Prefix prepended to every ingested channel name.

  • channel_name_overrides (Mapping[str, str] | None)

    Mapping of original channel names to their ingested names.

  • tags (Mapping[str, str] | None)

    Key-value pairs applied as tags to all data from this file.

Returns:

This builder, for chaining.

Raises:

ValueError – The path is not Parquet.

Return type:

Self

add_tabular_data(path, timestamp_column, timestamp_type, *, tag_columns=None, units=None, channel_prefix=None, channel_name_overrides=None, tags=None)#

Register a tabular file by forwarding to add_csv() or add_parquet().

Supported extensions: .csv / .csv.gz, .parquet / .parquet.gz, and the parquet-archive formats (.parquet.tar / .parquet.tar.gz / .parquet.zip). The format is inferred from the extension. Use add_csv() for CSV-specific row options.

Parameters:
  • path (Path | str | DriveFileRevision)

    Local file path or Drive revision. The revision’s recorded path determines its format.

  • timestamp_column (str)

    Column containing the timestamp for each row. This column is not ingested as its own channel; it sets the timestamps for every other channel.

  • timestamp_type (Iso8601 | Epoch | Relative | Custom | Literal['iso_8601', 'epoch_picoseconds', 'epoch_nanoseconds', 'epoch_microseconds', 'epoch_milliseconds', 'epoch_seconds', 'epoch_minutes', 'epoch_hours', 'epoch_days'])

    Type of the timestamp data in timestamp_column, e.g. ‘epoch_seconds’.

  • tag_columns (Mapping[str, str] | None)

    Mapping of tag keys to the columns whose values supply each tag.

  • units (Mapping[str, str] | None)

    Mapping of channel name to unit symbol.

  • channel_prefix (str | None)

    Prefix prepended to every channel name ingested from this file.

  • channel_name_overrides (Mapping[str, str] | None)

    Mapping of original channel name to the name to ingest it under.

  • tags (Mapping[str, str] | None)

    Key-value pairs applied as tags to all data from this file.

Returns:

This builder, for chaining.

Raises:

ValueError – The path is not a supported tabular format.

Return type:

Self

add_tags(tags)#

Add request-level tags applied to every item in the job.

Parameters:

tags (Mapping[str, str])

Key-value pairs to merge into the request-level tags.

Returns:

This builder, for chaining.

Return type:

Self

add_video(path: Path | str | DriveFileRevision, channel: str, *, start: datetime | int, tags: Mapping[str, str] | None = None) → Self#
add_video(path: Path | str | DriveFileRevision, channel: str, *, frame_timestamps: Sequence[int], tags: Mapping[str, str] | None = None) → Self

Register a video file.

Pass exactly one of start / frame_timestamps; the overloads make anything else a type error, and the runtime guard below rejects it for callers without a type checker. With start, frames are timestamped from that instant at the video’s own frame rate. With frame_timestamps, the per-frame timestamps are written to a manifest file that is uploaded alongside the video.

Parameters:
  • path (Path | str | DriveFileRevision)

    Local video path or Drive revision. The extension determines the format.

  • channel (str)

    Channel name to ingest the video under.

  • start (datetime | int | None)

    Timestamp of the video’s first frame.

  • frame_timestamps (Sequence[int] | None)

    One epoch-nanosecond timestamp per video frame.

  • tags (Mapping[str, str] | None)

    Key-value pairs applied as tags to the video.

Returns:

This builder, for chaining.

Raises:

ValueError – if channel is empty, the path is not a supported video container, frame_timestamps is empty, or both or neither of start / frame_timestamps are given.

Return type:

Self

submit(*, allow_partial=False, runs_to_expand=None)#

Upload local files and submit them alongside Drive revisions in one ingest job.

Uploads run in parallel, with transient failures (network weather, throttling) retried by the uploader’s own per-file budget. By default, the first permanent upload failure cancels remaining uploads and raises without submitting an ingest job. With allow_partial=True, uploads run to settlement; items with failed uploads are logged and dropped. The job includes the remaining items, including Drive-only items. Server-side ingestion can fail after submission; track the returned job’s status.

Single-use: one submit() consumes the builder, whether it succeeds or fails. A failed trigger request can have been committed server-side (a timeout, say), so there is no retry that cannot double-ingest — build a new builder instead.

Parameters:
  • allow_partial (bool)

    If true, items whose files failed to upload are dropped from the job (each failure logged as an error) instead of failing the whole batch. Deliberately reported through logs, not the return value — the job always includes eligible Drive items as well as successfully uploaded local items. It does not suppress server-side ingestion errors.

  • runs_to_expand (Sequence[Run | str] | None)

    If provided, runs (or their rids) to expand upon successful ingest. This will only expand the bounds of the runs, not contract.

Returns:

The created ingest job. Track it by polling job.refresh().status, or block on its produced files with list(job.as_files_ingested()).

Raises:
  • NominalIngestError – this builder was already submitted.

  • NominalIngestUploadFailed – a local upload failed when allow_partial is false, or upload failures left no eligible items when it is true. Members carry per-file detail.

  • ValueError – if no files have been added.

Return type:

IngestionJob