Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions docs/customizer/tutorials/optimize-throughput.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@
"source": [
"Install additional dependencies if they are not installed in your Python environment.\n",
"\n",
"The cell below automatically detects your environment and uses:\n",
"- `uv pip install` if you're in a uv-managed virtual environment\n",
"- `pip install` otherwise\n",
"The cell below uses the `%pip` so the packages install into the same Python kernel that is running this notebook.\n",
"\n",
"Required packages:\n",
"- `datasets` - Download the public [rajpurkar/squad](https://huggingface.co/datasets/rajpurkar/squad) dataset\n",
Expand All @@ -98,11 +96,7 @@
},
"outputs": [],
"source": [
"if command -v uv >/dev/null 2>&1 && [ -n \"$VIRTUAL_ENV\" ]; then\n",
" uv pip install datasets pandas matplotlib nvidia-ml-py\n",
"else\n",
" pip install datasets pandas matplotlib nvidia-ml-py\n",
"fi"
"%pip install -q datasets pandas matplotlib nvidia-ml-py"
]
},
{
Expand Down Expand Up @@ -885,16 +879,13 @@
"outputs": [],
"source": [
"from nemo_platform.types.jobs import PlatformJobStep\n",
"from datetime import datetime\n",
"import pandas as pd\n",
"\n",
"STEP_NAME = \"training\"\n",
"\n",
"def get_elapsed_time(step: PlatformJobStep) -> float:\n",
" \"\"\"Calculate elapsed time in seconds from step's created_at to updated_at.\"\"\"\n",
" created_at = datetime.fromisoformat(step.created_at.replace(\"Z\", \"+00:00\"))\n",
" updated_at = datetime.fromisoformat(step.updated_at.replace(\"Z\", \"+00:00\"))\n",
" return (updated_at - created_at).total_seconds()\n",
" return (step.updated_at - step.created_at).total_seconds()\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

python3 - <<'PY'
import json, re, pathlib

paths = [
    "docs/customizer/tutorials/optimize-throughput.ipynb",
    "docs/customizer/tutorials/optimize-throughput.mdx",
]

for p in paths:
    path = pathlib.Path(p)
    print(f"\n## {p}")
    if not path.exists():
        print("MISSING")
        continue
    if p.endswith(".ipynb"):
        nb = json.loads(path.read_text())
        for i, cell in enumerate(nb.get("cells", [])):
            src = "".join(cell.get("source", []))
            if "created_at" in src or "updated_at" in src or "total_seconds()" in src:
                print(f"\n-- cell {i} ({cell.get('cell_type')}) --")
                print(src)
    else:
        text = path.read_text()
        for m in re.finditer(r".{0,120}(created_at|updated_at|total_seconds\(\)).{0,120}", text):
            print(m.group(0))
PY

Repository: NVIDIA-NeMo/nemo-platform

Length of output: 1953


Update docs/customizer/tutorials/optimize-throughput.mdx. It still parses created_at/updated_at as strings while the notebook subtracts the datetime fields directly, so the published tutorial keeps the wrong timing code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/customizer/tutorials/optimize-throughput.ipynb` at line 888, Update the
timing calculation in optimize-throughput.mdx to parse created_at and updated_at
into datetime values before subtracting them, matching the notebook’s direct
datetime-field subtraction behavior. Locate the relevant step timing code and
ensure it no longer treats either timestamp as a string.

"\n",
"step_with_sequence_packing = client.jobs.steps.retrieve(\n",
" name=STEP_NAME,\n",
Expand Down
Loading