Skip to content

feat(04_dependencies): add mixed_worker and GPU vs CPU packaging docs#42

Merged
deanq merged 4 commits intomainfrom
deanq/ae-2410-fix-cpu-endpoint-missing-numpy
Mar 10, 2026
Merged

feat(04_dependencies): add mixed_worker and GPU vs CPU packaging docs#42
deanq merged 4 commits intomainfrom
deanq/ae-2410-fix-cpu-endpoint-missing-numpy

Conversation

@deanq
Copy link
Member

@deanq deanq commented Mar 10, 2026

Summary

  • Add mixed_worker.py demonstrating numpy used by both GPU and CPU endpoints
  • Update 04_dependencies/README.md with GPU vs CPU packaging section, build exclusions, runtime safety net docs
  • Fix stale GpuGroup references to GpuType.NVIDIA_GEFORCE_RTX_4090

Companion PRs:

Test plan

  • make quality-check passes
  • python mixed_worker.py runs locally without errors
  • flash run in 04_dependencies/ discovers all three workers

…ing docs

Add mixed_worker.py demonstrating numpy used by both GPU and CPU
endpoints -- the key scenario where the dependency blacklist fix matters.

Update README with GPU vs CPU packaging section explaining base image
differences, build exclusions, and the runtime safety net.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “mixed dependencies” worker example and expands the dependency-management documentation to explain how Flash packages dependencies differently for GPU vs CPU runtimes.

Changes:

  • Add mixed_worker.py showing a shared Python dependency (numpy) used by both GPU and CPU endpoints.
  • Expand 04_dependencies/README.md with GPU vs CPU packaging guidance, build exclusions, and runtime behavior notes.
  • Update README code snippets to use GpuType.NVIDIA_GEFORCE_RTX_4090 instead of stale GpuGroup examples.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
01_getting_started/04_dependencies/mixed_worker.py New example worker demonstrating shared dependency usage across GPU/CPU endpoints.
01_getting_started/04_dependencies/README.md Documentation updates for packaging behavior, exclusions, and updated GPU type references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

deanq added 3 commits March 9, 2026 20:57
- Clarify GPU worker docstring: numpy computations are CPU-bound despite GPU instance
- Add input validation for size (clamped 1-10000) and values (list, max 100k elements)
- Add note about GpuGroup vs GpuType enum inconsistency in README
Replace untyped `request: dict` with `numbers: list[float]` to fix
division by zero on empty input and provide proper Swagger examples.
Module-level Pydantic models cannot be used in LB endpoints because
function bodies are serialized to remote workers.
- Use typed param (numbers: list[float]) instead of untyped dict for
  proper Swagger examples and input validation
- Remove broad except Exception that swallowed ImportError as misleading
  device info; torch should be available on GPU worker images
- Add dependencies=["torch"] for environments where torch needs explicit
  installation
Copy link

@runpod-Henrik runpod-Henrik left a comment

Choose a reason for hiding this comment

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

What changed: New mixed_worker.py demonstrating numpy on both a GPU and a CPU endpoint in the same file. Updated README documenting GPU vs CPU packaging differences and build exclusions. gpu_lb.py cleanup: typed parameters, torch declared as a dependency, defensive error-swallowing removed.

What was tested:

  • mixed_worker.py end-to-end — both GPU (matrix multiply) and CPU (statistics) endpoints executed on RunPod infrastructure and completed successfully with numpy available in both runtime environments
  • flash run at repo root — both new endpoints discovered and routable alongside all existing workers, no collisions

What works: numpy available on both GPU and CPU endpoints. Both workers discoverable and routable.

Verdict: Pass.

@deanq deanq merged commit 319e2eb into main Mar 10, 2026
6 checks passed
@deanq deanq deleted the deanq/ae-2410-fix-cpu-endpoint-missing-numpy branch March 10, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants