Skip to content

Ingestion run lifecycle: list / status / cancel (SDK helpers + server endpoints) #4

@rorybyrne

Description

@rorybyrne

Summary

osa exposes exactly one ingestion operation today — start_ingestion (POST /api/v1/ingestions) plus discover_ingestable_conventions. There's no way to list ingestion runs, get the status of a run, or cancel a running one. Downstream CLIs (e.g. amacrin) want to present ingestion as a resource group (amacrin ingest start|list|status|cancel), but only start can be backed right now.

An ingestion is a run (a job), so the natural surface is create / read / cancel — there's no meaningful "update":

  • start — already exists (start_ingestion).
  • list — list runs for an archive/convention.
  • status — get one run by id.
  • cancel — stop a running ingestion.

What's needed

SDK helpers (in osa/cli/ingestion.py, reusable by downstream CLIs)

def list_ingestions(*, server, token, convention=None, http=None) -> list[dict]: ...   # GET  /api/v1/ingestions
def get_ingestion(*, server, ingestion_id, token, http=None) -> dict: ...               # GET  /api/v1/ingestions/{id}
def cancel_ingestion(*, server, ingestion_id, token, http=None) -> dict: ...            # POST /api/v1/ingestions/{id}/cancel (or DELETE)

Same shape/conventions as start_ingestion (keyword-only, injectable http, raise IngestionError on failure).

Archive-server endpoints

  • GET /api/v1/ingestions (optionally filtered by convention SRN) → list of runs.
  • GET /api/v1/ingestions/{id} → one run (status, counts, timestamps).
  • POST /api/v1/ingestions/{id}/cancel (or DELETE /api/v1/ingestions/{id}) → cancel.

CLI

Extend the osa ingestion sub-app with list, status, cancel alongside start.

Why

amacrin now models ingestion as a noun sub-app (amacrin ingest start) to match its archive group, but it can only wrap start until these SDK helpers + endpoints exist. Centralizing the helpers in osa (as was done for discover_ingestable_conventions in #2) lets amacrin ingest list/status/cancel be thin wrappers rather than reimplementing HTTP against the archive server.

Acceptance criteria

  • list_ingestions, get_ingestion, cancel_ingestion helpers in osa/cli/ingestion.py, unit-tested at the http boundary.
  • Corresponding archive-server endpoints.
  • osa ingestion list|status|cancel commands.
  • IngestionError raised with useful detail on failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions