Skip to content

refactor: conform examples to latest Flash patterns#17

Merged
deanq merged 7 commits intomainfrom
deanq/ae-1941-conform-to-the-latest
Jan 29, 2026
Merged

refactor: conform examples to latest Flash patterns#17
deanq merged 7 commits intomainfrom
deanq/ae-1941-conform-to-the-latest

Conversation

@deanq
Copy link
Member

@deanq deanq commented Jan 29, 2026

Summary

Comprehensive updates to flash-examples to align with latest Flash patterns, documentation standards, and best practices.

  • Add mothership endpoint configurations for load-balanced serving
  • Improve documentation with comprehensive example READMEs
  • Fix configuration issues and optimize instance types
  • Refactor code to follow CLAUDE.md best practices

Changes

Documentation & Configuration

  • Update CLAUDE.md with mothership configuration patterns and examples
  • Update CONTRIBUTING.md with simplified Flash patterns
  • Add comprehensive READMEs to hello_world and cpu_worker examples
  • Add .gitignore patterns for Flash auto-generated files

Mothership Endpoints

  • Add mothership.py configurations to all 5 examples
  • Auto-scaling CPU-optimized load balancing
  • Configurable worker scaling (min/max)

Bug Fixes & Optimizations

  • Fix hello_world pyproject.toml project name (copy-paste error)
  • Optimize instance types: CPU3C_1_2 for lightweight, CPU3C_8_16 for larger workloads
  • Remove unused config parameters and imports

Code Refactoring

  • Consolidate duplicate config objects in mixed_workers
  • Move VALID_OPERATIONS constant to local scope in load_balancer (@Remote best practice)
  • Code formatting fixes

Test Plan

  • Run flash run to verify all endpoints work
  • Test endpoints via Swagger UI at http://localhost:8888/docs
  • Verify make quality-check passes (format, lint, type checking)
  • Review mothership configurations for correctness
  • Verify documentation is accurate and helpful

deanq added 6 commits January 29, 2026 10:50
Prevent accidental commits of Flash build artifacts:
- flash_manifest.json (auto-generated by flash build)
- uv.lock (example-specific lock files)
- Root uv.lock tracks all consolidated dependencies
Add comprehensive mothership configuration documentation:
- Document mothership.py pattern in project structure
- Add mothership customization examples to CLAUDE.md
- Simplify LiveServerless example in CONTRIBUTING.md
- Clarify auto-generated file handling
- Update directory structure patterns with mothership references
Enable mothership load-balanced endpoints for all examples:
- Auto-scaling CPU-optimized load balancing
- Configurable worker min/max scaling
- Template showing GPU variant options
- Instructions for disabling if not needed
Add quick start guides for hello_world and cpu_worker:
- Installation and setup instructions
- Local testing workflows with flash run
- API endpoint documentation with curl examples
- Architecture explanations and learning objectives
- CPU vs GPU worker comparison and guidance
Fix incorrect project name and optimize instance type selections:
- Fix 01_hello_world pyproject.toml name (was "02_cpu_worker")
- Update cpu_worker to CPU3C_1_2 (right-sized for light workload)
- Update dependencies examples to CPU3C_8_16 and CPU3C_1_2
- Optimize load_balancer GPU worker instance selection
- Remove unused imports and config parameters
…code

Mixed workers:
- Merge preprocess_config and postprocess_config into single cpu_config
- Both workers use identical resource requirements

Load balancer:
- Move VALID_OPERATIONS constant into function scope
- Remove unused config parameters (workersMin, instanceIds, template)
- Simplify to minimal required configuration
@linear
Copy link

linear bot commented Jan 29, 2026

@deanq deanq requested a review from Copilot January 29, 2026 19:36
Copy link

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

Comprehensive update to flash-examples to align with latest Flash patterns, improving documentation, configuration, and code maintainability across all examples.

Changes:

  • Added mothership endpoint configurations to all examples with auto-scaling load balancing
  • Improved documentation with comprehensive READMEs for hello_world and cpu_worker examples
  • Fixed configuration bugs and optimized instance types for better resource utilization
  • Refactored code to follow CLAUDE.md best practices, including moving constants to local scope in @Remote functions

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CONTRIBUTING.md Simplified Flash patterns by removing verbose config parameters and version pins
CLAUDE.md Added mothership configuration documentation, file structure patterns, and @Remote best practices
03_advanced_workers/05_load_balancer/workers/gpu/endpoint.py Removed unused gpus parameter from LiveLoadBalancer config
03_advanced_workers/05_load_balancer/workers/cpu/endpoint.py Moved VALID_OPERATIONS constant to local scope and removed unused config parameters
03_advanced_workers/05_load_balancer/mothership.py Added mothership endpoint configuration with examples
03_advanced_workers/05_load_balancer/.gitignore Added Flash auto-generated files to ignore patterns
01_getting_started/04_dependencies/workers/gpu/endpoint.py Updated GPU types to more specific models
01_getting_started/04_dependencies/workers/cpu/endpoint.py Optimized CPU instance types for workload characteristics
01_getting_started/04_dependencies/mothership.py Added mothership endpoint configuration
01_getting_started/04_dependencies/.gitignore Added Flash auto-generated files to ignore patterns
01_getting_started/03_mixed_workers/workers/cpu/endpoint.py Consolidated duplicate config objects into single cpu_config
01_getting_started/03_mixed_workers/mothership.py Added mothership endpoint configuration
01_getting_started/03_mixed_workers/.gitignore Added Flash auto-generated files to ignore patterns
01_getting_started/02_cpu_worker/mothership.py Added mothership endpoint configuration
01_getting_started/02_cpu_worker/cpu_worker.py Changed from ANY to specific CPU3C_1_2 instance type
01_getting_started/02_cpu_worker/README.md Added comprehensive example documentation
01_getting_started/02_cpu_worker/.gitignore Added Flash auto-generated files to ignore patterns
01_getting_started/01_hello_world/pyproject.toml Fixed project name from copy-paste error
01_getting_started/01_hello_world/mothership.py Added mothership endpoint configuration
01_getting_started/01_hello_world/README.md Added comprehensive example documentation
01_getting_started/01_hello_world/.gitignore Added Flash auto-generated files to ignore patterns

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

@deanq deanq changed the title Conform examples to latest Flash patterns refactor: conform examples to latest Flash patterns Jan 29, 2026
@deanq deanq merged commit 2e5142f into main Jan 29, 2026
6 checks passed
@deanq deanq deleted the deanq/ae-1941-conform-to-the-latest branch January 29, 2026 21:33
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.

3 participants