interloper-api 0.122.1__tar.gz → 0.123.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {interloper_api-0.122.1 → interloper_api-0.123.0}/PKG-INFO +1 -1
  2. {interloper_api-0.122.1 → interloper_api-0.123.0}/pyproject.toml +1 -1
  3. {interloper_api-0.122.1 → interloper_api-0.123.0}/pyproject.toml.orig +1 -1
  4. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/runs.py +40 -7
  5. {interloper_api-0.122.1 → interloper_api-0.123.0}/README.md +0 -0
  6. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/__init__.py +0 -0
  7. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/app.py +0 -0
  8. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/authorization.py +0 -0
  9. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/cli.py +0 -0
  10. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/dependencies/__init__.py +0 -0
  11. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/dependencies/auth.py +0 -0
  12. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/dependencies/rbac.py +0 -0
  13. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/dependencies/state.py +0 -0
  14. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/login.py +0 -0
  15. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/notifications/__init__.py +0 -0
  16. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/notifications/base.py +0 -0
  17. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/notifications/invitations.py +0 -0
  18. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/notifications/super_admins.py +0 -0
  19. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/__init__.py +0 -0
  20. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/admin.py +0 -0
  21. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/agent.py +0 -0
  22. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/apps.py +0 -0
  23. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/auth.py +0 -0
  24. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/authorization.py +0 -0
  25. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/backfills.py +0 -0
  26. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/catalog.py +0 -0
  27. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/components.py +0 -0
  28. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/executions.py +0 -0
  29. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/health.py +0 -0
  30. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/oauth.py +0 -0
  31. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/organisations.py +0 -0
  32. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/overview.py +0 -0
  33. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/relations.py +0 -0
  34. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/tokens.py +0 -0
  35. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/routes/websocket.py +0 -0
  36. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/server.py +0 -0
  37. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/utils/__init__.py +0 -0
  38. {interloper_api-0.122.1 → interloper_api-0.123.0}/src/interloper_api/utils/time.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: interloper-api
3
- Version: 0.122.1
3
+ Version: 0.123.0
4
4
  Summary: Interloper FastAPI routes
5
5
  Author: Guillaume Onfroy
6
6
  Author-email: Guillaume Onfroy <guillaume@digitlcloud.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "interloper-api"
3
- version = "0.122.1"
3
+ version = "0.123.0"
4
4
  description = "Interloper FastAPI routes"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -3,7 +3,7 @@
3
3
  # ###############
4
4
  [project]
5
5
  name = "interloper-api"
6
- version = "0.122.1"
6
+ version = "0.123.0"
7
7
  description = "Interloper FastAPI routes"
8
8
  readme = "README.md"
9
9
  authors = [{ name = "Guillaume Onfroy", email = "guillaume@digitlcloud.com" }]
@@ -1,9 +1,10 @@
1
- """Runs API: queue, inspect, retry and cancel runs, read their executions and events, take in a run's reports.
1
+ """Runs API: queue, inspect, retry and cancel runs, read their executions and events; serve a run's own process.
2
2
 
3
3
  Two routers: ``org_router`` is mounted under the organisation's path and serves
4
- its members; ``router`` is mounted at the API root and serves a run's pod, which
5
- authenticates as its run (:func:`~interloper_api.dependencies.require_run`) and
6
- names no organisation.
4
+ its members; ``router`` is mounted at the API root and serves the process that
5
+ executes a run, which authenticates as its run
6
+ (:func:`~interloper_api.dependencies.require_run`), names no organisation,
7
+ loads what the run executes and reports what happened.
7
8
  """
8
9
 
9
10
  from __future__ import annotations
@@ -14,9 +15,10 @@ from uuid import UUID
14
15
 
15
16
  import interloper as il
16
17
  from fastapi import APIRouter, Depends, HTTPException, Query
17
- from interloper.errors import EventError
18
- from interloper_db import EventQuery, ExecutionQuery, Page, PageQuery, RunQuery
19
- from interloper_db.models import Event, Run
18
+ from interloper.errors import EventError, PartitionError
19
+ from interloper.runner.spec import RunSpec
20
+ from interloper_db import EventQuery, ExecutionQuery, NotFoundError, Page, PageQuery, RunQuery
21
+ from interloper_db.models import Event, Run, RunStatus
20
22
  from pydantic import BaseModel, Field
21
23
 
22
24
  from interloper_api.dependencies import (
@@ -340,6 +342,37 @@ def list_run_events(
340
342
  return store.events.list(run.org_id, query, run_id=run_id).map(EventResponse.from_event)
341
343
 
342
344
 
345
+ @router.get("/{run_id}/spec")
346
+ def get_spec(run: Annotated[Run, Depends(require_run)], store: StoreDep) -> RunSpec:
347
+ """What the run executes, built from its row as it stands: the process that executes it loads it once started.
348
+
349
+ Only the run's own token is accepted (`require_run`), and only while the
350
+ run is dispatched or running: a run ended elsewhere is not to be started.
351
+
352
+ Args:
353
+ run: The run its token stands for.
354
+ store: The Store instance.
355
+
356
+ Returns:
357
+ The run's DAG, its connections resolved, the partition it covers and
358
+ its event metadata.
359
+
360
+ Raises:
361
+ HTTPException: 409 when the run is no longer live, or can no longer be
362
+ built (its target deleted, or selecting nothing, or its window
363
+ refused).
364
+ """
365
+ if run.status not in (RunStatus.DISPATCHED, RunStatus.RUNNING):
366
+ raise HTTPException(status_code=409, detail=f"Run {run.id} is {run.status}, not live")
367
+ try:
368
+ spec = store.runs.spec(run.id)
369
+ except (NotFoundError, TypeError, PartitionError) as error:
370
+ raise HTTPException(status_code=409, detail=str(error)) from error
371
+ if spec is None:
372
+ raise HTTPException(status_code=409, detail=f"Run {run.id} selects no operations")
373
+ return spec
374
+
375
+
343
376
  class IngestResponse(BaseModel):
344
377
  """Whether the run was live when the batch arrived."""
345
378