Development lifecycle
The typical workflow starts with writing your handler function. Your handler receives an event object with input data and returns a response. Once you have a handler function, test it locally using the Runpod SDK’s testing environment. You can test with inline JSON inputs, use a local API server, or simulate concurrency, all without actually deploying your code and incurring charges. When your handler is working correctly, package it into a Docker image and deploy it to a Serverless endpoint. Your worker will auto-scale based on demand. Once deployed, use logs, metrics, and SSH access to troubleshoot issues and optimize performance in production.Local testing
The Runpod SDK provides a comprehensive local testing environment:- Basic testing: Run your handler with inline JSON or test files.
- Local API server: Simulate HTTP requests to your Serverless endpoint.
- Concurrency testing: Test how your handler performs under parallel execution.
- Debug mode: Enable detailed logging and troubleshooting output.
Error handling
Implement robust error handling to ensure your workers remain stable and return useful error messages. Learn more in Error handling.SDK utilities
The Runpod SDK includes helper functions to make your handlers more robust:- Input validation: Validate request data against a schema.
- Cleanup utilities: Automatically remove temporary files after processing.
Benchmarking and optimization
Optimize your workers for performance and cost:- Benchmark response times: Measure cold start and execution time.
- Optimize your workers: Reduce startup and execution times.
Pod-first development
For faster iteration and debugging of GPU-intensive applications, develop on a Pod first, then deploy the same Docker image to Serverless. This workflow provides:- Interactive development with Jupyter Notebooks.
- Direct SSH access to the GPU environment.
- Faster iteration compared to deploying repeatedly to Serverless.
Debugging and observability
Runpod provides several tools for debugging and monitoring:- Logs: View real-time and historical logs from your workers.
- Metrics: Monitor execution time, delay time, and resource usage.
- SSH access: Connect directly to running workers for live debugging.