Skip to content

Commit c10e8d4

Browse files
authored
Merge pull request #320 from NVIDIA/attrsvc-packaging-cleanup
Clean up attrsvc packaging ownership
2 parents 9c6adea + 1794bc9 commit c10e8d4

85 files changed

Lines changed: 474 additions & 539 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Shared infrastructure: `health_check.py` (GPU/NIC/storage health checks via NVML
9898
## Repository Root
9999

100100
### `services/`
101-
Standalone services at the **repository root** (`services/`, not inside `src/nvidia_resiliency_ext/`): `nvrx_attrsvc/` (FastAPI server for LLM log analysis), `nvrx_smonsvc/` (SLURM job monitor).
101+
Deployment assets for standalone services: `attrsvc/` (FastAPI server for LLM log analysis), `smonsvc/` (SLURM job monitor), and shared scripts. Python service packages live under `src/nvidia_resiliency_ext/services/`.
102102

103103
## Key Environment Variables
104104

build.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,6 @@ def _compile_protos(proto_dir, proto_filenames):
165165

166166

167167
def build(setup_kwargs):
168-
# ``pyproject.toml`` installs ``services/nvrx_attrsvc`` under the
169-
# ``nvidia_resiliency_ext.attribution`` namespace via Poetry's package
170-
# ``to`` target. The generated setuptools build path does not understand
171-
# that target and would otherwise also emit a top-level ``nvrx_attrsvc``.
172-
packages = setup_kwargs.get("packages")
173-
if packages:
174-
setup_kwargs["packages"] = [
175-
pkg for pkg in packages if pkg != "nvrx_attrsvc" and not pkg.startswith("nvrx_attrsvc.")
176-
]
177-
for package_data_key in ("package_data", "exclude_package_data"):
178-
package_data = setup_kwargs.get(package_data_key)
179-
if isinstance(package_data, dict):
180-
package_data.pop("nvrx_attrsvc", None)
181-
182168
# Generate gRPC Python files from .proto files
183169
proto_dir = os.path.join("src", "nvidia_resiliency_ext", "shared_utils", "proto")
184170
proto_files = [

examples/attribution/single_server_example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
sys.path.insert(0, str(Path(__file__).parent.parent.parent / "src"))
2020

2121
from nvidia_resiliency_ext.attribution.mcp_integration.mcp_client import NVRxMCPClient
22-
from nvidia_resiliency_ext.attribution.svc.config import DEFAULT_LLM_BASE_URL, DEFAULT_LLM_MODEL
22+
from nvidia_resiliency_ext.attribution.orchestration.config import (
23+
DEFAULT_LLM_BASE_URL,
24+
DEFAULT_LLM_MODEL,
25+
)
2326

2427
logger = logging.getLogger(__name__)
2528
logging.basicConfig(

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ classifiers = [
1717
]
1818
packages = [
1919
{ include = "nvidia_resiliency_ext", from = "src" },
20-
{ include = "nvrx_attrsvc", from = "services", to = "nvidia_resiliency_ext/attribution" },
2120
]
2221

2322
exclude = [
@@ -60,14 +59,16 @@ pydantic-settings = { version = ">=2.0.0", optional = true }
6059
slowapi = { version = ">=0.1.9", optional = true }
6160
slack-bolt = { version = ">=1.23.0", optional = true }
6261
slack-sdk = { version = ">=3.35.0", optional = true }
62+
nvdataflow = { version = "*", optional = true }
6363
grpcio = "^1.76.0"
6464
grpcio-tools = "^1.76.0"
6565
protobuf = ">=4.22.0"
6666

6767
[tool.poetry.scripts]
6868
ft_launcher = "nvidia_resiliency_ext.fault_tolerance.launcher:main"
6969
nvrx-mcp-analysis = "nvidia_resiliency_ext.attribution.mcp_integration.server_launcher:main"
70-
nvrx-attrsvc = "nvidia_resiliency_ext.attribution.nvrx_attrsvc.app:main"
70+
nvrx-attrsvc = "nvidia_resiliency_ext.services.attrsvc.__main__:main"
71+
nvrx-smonsvc = "nvidia_resiliency_ext.services.smonsvc.__main__:main"
7172

7273
[tool.poetry.extras]
7374
attribution = [
@@ -83,6 +84,9 @@ attribution = [
8384
"slack-bolt",
8485
"slack-sdk",
8586
]
87+
dataflow = [
88+
"nvdataflow",
89+
]
8690

8791
[tool.poetry-dynamic-versioning]
8892
enable = true

services/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Automated log analysis and failure attribution for distributed training jobs.
66

77
| Component | Description | Documentation |
88
|-----------|-------------|---------------|
9-
| **nvrx-attrsvc** | FastAPI server for LLM-based log analysis | [nvrx_attrsvc/README.md](nvrx_attrsvc/README.md) |
10-
| **nvrx-smonsvc** | SLURM job monitor for automatic log submission | [nvrx_smonsvc/README.md](nvrx_smonsvc/README.md) |
9+
| **nvrx-attrsvc** | FastAPI server for LLM-based log analysis | [attrsvc/README.md](attrsvc/README.md) |
10+
| **nvrx-smonsvc** | SLURM job monitor for automatic log submission | [smonsvc/README.md](smonsvc/README.md) |
1111

1212
See component READMEs for quick start, configuration, and API details.
1313

@@ -43,8 +43,8 @@ Periodically snapshot service endpoints for debugging:
4343
./scripts/snapshot_services.sh hostname
4444

4545
# Individual services (in respective directories)
46-
./nvrx_attrsvc/snapshot_attrsvc.sh hostname 8000
47-
./nvrx_smonsvc/deploy/snapshot_smonsvc.sh hostname 8100
46+
./attrsvc/deploy/snapshot_attrsvc.sh hostname 8000
47+
./smonsvc/deploy/snapshot_smonsvc.sh hostname 8100
4848
```
4949

5050
Configure via environment: `SNAPSHOT_INTERVAL`, `SNAPSHOT_OUTPUT_DIR`.
@@ -53,12 +53,11 @@ Configure via environment: `SNAPSHOT_INTERVAL`, `SNAPSHOT_OUTPUT_DIR`.
5353

5454
| Path | Description |
5555
|------|-------------|
56-
| `nvrx_attrsvc/` | Attribution service package |
57-
| `nvrx_smonsvc/` | SLURM monitor package |
56+
| `attrsvc/` | Attribution service deployment docs and assets |
57+
| `smonsvc/` | SLURM monitor deployment docs and assets |
5858
| `scripts/` | Shell scripts ([README](scripts/README.md)) |
59-
| `pyproject.toml` | Python package configuration |
6059

6160
## Library Layer
6261

6362
The core analysis functionality in `nvidia_resiliency_ext.attribution` can be used without HTTP.
64-
See [nvrx_attrsvc/README.md](nvrx_attrsvc/README.md#python-api) for the Python API.
63+
See [attrsvc/README.md](attrsvc/README.md#python-api) for the Python API.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ processed-files ledger (`CACHE_FILE`) — see §3.7. **README.md** for runbooks.
7979
--------------------------------------------------------------------------------
8080

8181
Two layers: **library** (`nvidia_resiliency_ext.attribution`) and **service**
82-
(`services/nvrx_attrsvc/` — FastAPI, `Settings`, rate limits, `AttributionHttpAdapter`).
82+
(`services/attrsvc/` — FastAPI, `Settings`, rate limits, `AttributionHttpAdapter`).
8383

8484
| Layer | See |
8585
|-------|-----|
@@ -391,7 +391,7 @@ implementation.
391391
Structured text default; levels per `LOG_LEVEL` (`DEBUG` / `INFO` / `WARNING`). No duplicated template table.
392392

393393
23. DEPENDENCIES
394-
**services/pyproject.toml**
394+
The root package owns service entry points and extras in **pyproject.toml**.
395395

396396
24. TESTING
397397
Layout and strategies are not normative for the HTTP contract; see repo **`tests/`**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FastAPI server that exposes log analysis over HTTP. It wraps the **`nvidia_resil
66

77
## Library vs this service
88

9-
| | **Library** (`nvidia_resiliency_ext.attribution`) | **This package** (`nvrx_attrsvc`) |
9+
| | **Library** (`nvidia_resiliency_ext.attribution`) | **This package** (`nvidia_resiliency_ext.services.attrsvc`) |
1010
|---|--------------------------------------------------|-----------------------------------|
1111
| **Role** | **`AttributionController`** (config, cache persistence, health/status, dataflow/Slack stats) over **`Analyzer`** (→ `LogAnalyzer`, pipelines, MCP/lib LogSage, FR analysis, jobs/splitlog) | HTTP API, env-based `Settings`, rate limits, ledger file |
1212
| **Docs** | [`src/nvidia_resiliency_ext/attribution/ARCHITECTURE.md`](../../src/nvidia_resiliency_ext/attribution/ARCHITECTURE.md), [`README.md`](../../src/nvidia_resiliency_ext/attribution/README.md) | This file, [`ATTRSVC_SPEC.md`](ATTRSVC_SPEC.md) |
@@ -238,7 +238,7 @@ For combined deployment with monitor, see `../scripts/nvrx_services.sbatch`
238238

239239
```python
240240
import asyncio
241-
from nvrx_attrsvc import AttributionHttpAdapter, setup
241+
from nvidia_resiliency_ext.services.attrsvc import AttributionHttpAdapter, setup
242242

243243
async def main():
244244
cfg = setup()
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NVRX Attribution Service - Docker Image
22
#
33
# Build (from repo root):
4-
# docker build -t nvrx-attrsvc -f services/nvrx_attrsvc/deploy/Dockerfile .
4+
# docker build -t nvrx-attrsvc -f services/attrsvc/deploy/Dockerfile .
55
#
66
# Run:
77
# docker run -d \
@@ -25,17 +25,12 @@ RUN apt-get update && \
2525
apt-get install -y --no-install-recommends curl && \
2626
rm -rf /var/lib/apt/lists/*
2727

28-
# Copy and install main library (no CUDA extensions needed for attribution)
29-
COPY pyproject.toml ./
28+
# Copy and install root package with attribution extras. The root package owns
29+
# both service entry points.
30+
COPY pyproject.toml README.md build.py ./
3031
COPY src/ ./src/
3132
ENV STRAGGLER_DET_SKIP_CUPTI_EXT_BUILD=1
32-
RUN pip install --no-cache-dir --no-deps .
33-
34-
# Copy and install attribution service
35-
COPY services/pyproject.toml ./services/
36-
COPY services/nvrx_attrsvc/ ./services/nvrx_attrsvc/
37-
COPY services/nvrx_smonsvc/ ./services/nvrx_smonsvc/
38-
RUN pip install --no-cache-dir ./services
33+
RUN pip install --no-cache-dir ".[attribution]"
3934

4035
# Verify commands are available
4136
RUN command -v nvrx-attrsvc && command -v nvrx-smonsvc

services/nvrx_attrsvc/deploy/kubernetes.yaml renamed to services/attrsvc/deploy/kubernetes.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NVRX Attribution Service - Kubernetes Deployment
22
#
33
# Deploy:
4-
# kubectl apply -f services/nvrx_attrsvc/deploy/kubernetes.yaml
4+
# kubectl apply -f services/attrsvc/deploy/kubernetes.yaml
55
#
66
# Prerequisites:
77
# - Create secret: kubectl create secret generic llm-api-key --from-literal=api-key=your-llm-api-key-here
File renamed without changes.

0 commit comments

Comments
 (0)