Skip to main content

kcai-data-sampling-job

Orchestration for kcai data-sampling: everything that turns a selection into files on disk. This package holds no algorithms — it is the layer that runs the methods other packages provide.

A campaign reads a source table, applies each configured transformation independently to the same source sample, and writes two things per output: a ledger row describing what was produced, and the payload file holding the sample itself. The ledger is metadata only; the pixels go to their own content-addressed file.

What it ships today

  • SamplingJob — the run loop.
  • The IO plugins: a parquet dataloader, and images and parquet output writers.
  • The ledger writer.
  • The process command, driven by YAML.

This is where the IO plugins live, and where image files are handled. It is also the only part of the workspace that depends on Pillow, and it needs it because it is the only part that encodes a decoded array to PNG. The transformation packages themselves never touch image files.

Install

pip install "kcai-data-sampling[job]"

This extra is also what turns on the process command:

kcai-data-sampling process -p config.yaml

Without it the command is not there — the umbrella CLI builds its command list from what is importable, so a base install offers version and list only.

How a run works

The job is a streaming loop. For each chunk of load_batch_size samples it decodes a selection into memory, runs every configured transformation over that chunk through the runner, encodes each output as a payload, buffers the metadata rows, and drops the chunk.

Batching changes nothing in the output. Transformations are unary and the pairing is chunk-local, so the same selection yields byte-identical results at any load_batch_size. That is why randomness is seeded per parent sample rather than per batch.

There is no chain. Every transformation is applied to the same source sample and each output is its own row — no intermediate stage, no transformation-of-a-transformation. Two transformations listed together produce two rows, not one row reached in two steps.

Output

The ledger is one row per generated sample, recording the lineage and the declaration: which selection and loader it came from, the source parent_id, the output id, the algorithm, its family, arity, reversible, the resolved params, the seed, and the tool_model / target_model names. Enough to reproduce or audit a row without opening the payload.

Source columns are opt-in and never overwrite the generated ones. include and exclude are pattern lists selecting source columns to carry through; exclude wins over include, and any source column sharing a name with a generated column is dropped from the pass-through rather than allowed to overwrite it. With neither set, nothing is passed through — the ledger holds only the generated columns.

Payload files are content-addressed. The file name is {selection}__{id}__{c6}.png, where c6 is a short hash of the decoded payload bytes. Identical pixels plus the same output id therefore name the same file, so artifact paths are invariant to buffering and flush order. The output id already covers the recipe — parent, algorithm, settings, seed — and the hash only guards content collisions.

Example

dataloaders:
  loaders:
    - name: images
      type: parquet
      path: /path/to/samples.parquet
      id_column: id
      load_batch_size: 10
      decode: img_bytes
      sample_path:
        - column: path
          prefix: /path/to/images

operations:
  outputs:
    path: /path/to/outputs/{selection}/ledger.parquet
    write_samples: true
    samples_dir: /path/to/outputs/{selection}/payloads
    flush_batch_size: 128
    include: [height, width]
  transformations:
    - name: horizontal_flip
      type: horizontal_flip
    - name: crop_resize
      type: crop_resize
      fraction:
        range: [0.3, 0.5]
        step: 0.1

{selection} in an output path is substituted per selection, so one config can write several campaigns into separate directories. The include list names source columns to carry into the ledger beyond the generated ones.

Extending it

The job discovers its parts through entry points, so a package can add a dataloader or an output writer without changing anything here:

  • kcai_data_sampling.dataloaders
  • kcai_data_sampling.outputwriter

Add your own dependencies to your package. This one is where IO lives, and keeping it free of algorithm-specific requirements is what lets a project compose a run out of any mix of the packages above.

Metadata

Release files for kcai-data-sampling-job 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kcai-data-sampling-job 0.8.1
File Size Uploaded Provenance Actions
kcai_data_sampling_job-0.8.1.tar.gz 24.8 kB Without provenance Details for kcai_data_sampling_job-0.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kcai-data-sampling-job 0.8.1
File Interpreter ABI Platform Actions
kcai_data_sampling_job-0.8.1-py3-none-any.whl Python 3 none any Details for kcai_data_sampling_job-0.8.1-py3-none-any.whl

Total release size: 53.0 kB

Release files / kcai_data_sampling_job-0.8.1.tar.gz

Download URL kcai_data_sampling_job-0.8.1.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6519a66190398339c2489077d753f0ebd01b3ede75bcf8edde9bf8fe45e97167
BLAKE2b-256 checksum
How to use checksums
3eaa9de82ff34ac9e0fb1c8b3041a057b61c47fdb0a9aa70c9804f4204b84bf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.17

Release files / kcai_data_sampling_job-0.8.1-py3-none-any.whl

Download URL kcai_data_sampling_job-0.8.1-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
909230c5710ef65b6983f0fc59f60dd549fb85368df1be0c411b4cb30c4c0e2c
BLAKE2b-256 checksum
How to use checksums
ec9ea0e882727a9ecafb2c4d86ac01e9de0f51f511cbd2ee0e320fdbc5715a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.17

Security for kcai-data-sampling-job 0.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page