Add POST /runs/import for runs executed elsewhere
A history recorded before the move (MLflow experiments) had nowhere to go, since runs were only made by running a flow. Each entry is stored as it ended: parameters completed and checked like a submit, cause "import", empty commit and code digest, metrics and artifacts written as given, nothing queued or announced. Run.external_id (new migration) makes a second import a no-op and is an export column so a row joins back. The request is all or nothing and capped at 200 entries; Client.import_runs pages a longer history. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QgG6TJw5qBZzaLghQSRVrq
This commit is contained in:
@@ -152,3 +152,32 @@ def test_an_export_is_read_as_rows(monkeypatch):
|
||||
assert seen["flow"] == "train"
|
||||
assert seen["status"] == "ok"
|
||||
assert [row["step"] for row in rows] == [0, 1]
|
||||
|
||||
|
||||
def test_a_history_is_imported_a_page_at_a_time(monkeypatch):
|
||||
"""The engine caps a request; the caller hands over the whole history."""
|
||||
import json
|
||||
|
||||
from fluksio.sdk.client import IMPORT_PAGE
|
||||
|
||||
pages = []
|
||||
|
||||
def handler(request):
|
||||
runs = json.loads(request.content)["runs"]
|
||||
pages.append(len(runs))
|
||||
return httpx.Response(
|
||||
202,
|
||||
json=[
|
||||
{"external_id": one["external_id"], "id": "r", "created": True}
|
||||
for one in runs
|
||||
],
|
||||
)
|
||||
|
||||
client = a_client(handler, monkeypatch)
|
||||
entries = [{"external_id": f"mlflow:1/{n}"} for n in range(IMPORT_PAGE + 1)]
|
||||
answers = client.import_runs(entries)
|
||||
|
||||
assert pages == [IMPORT_PAGE, 1]
|
||||
assert [one["external_id"] for one in answers] == [
|
||||
e["external_id"] for e in entries
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user