Skip to main content
Fitness checks validate a worker’s environment at startup, before it begins processing jobs. When a worker starts, Runpod runs each registered check in order. If a check fails, the worker logs the error, exits, and is marked unhealthy so Runpod can restart or replace it before any traffic reaches it. This lets you catch problems like a missing GPU, a model that won’t load, or absent configuration up front, instead of failing requests one by one in production. Fitness checks are available in the Runpod Python SDK starting with version 1.9.0. To use them, make sure your worker image installs runpod>=1.9.0. There are two kinds of fitness checks: custom checks that you define for your own workload, and automatic system checks that Runpod runs for you without any code changes.

Register a custom fitness check

Use the @runpod.serverless.register_fitness_check decorator to register your own checks. A check is a function that raises an exception (typically RuntimeError) to signal failure. If it returns without raising, the check passes. Both synchronous and asynchronous functions are supported.
handler.py

Asynchronous checks

Checks can also be asynchronous functions, which is useful for I/O-bound validation such as confirming connectivity to an external service:
handler.py

When checks run

Custom checks run once at worker startup, before the first job, and they execute in the order you register them. They run only on the Runpod Serverless platform, so they’re skipped during local development and testing. When a check fails, Runpod logs the check name and exception, the worker exits with code 1, and the container is marked unhealthy so your endpoint can restart it. When all checks pass, the worker starts its heartbeat and begins accepting jobs. A failed startup looks like this in the logs:
A successful startup logs each check as it runs:

Custom check examples

The following examples cover common readiness checks you can adapt to your own workload. Verify that a GPU is available and has enough memory:
Confirm that required model files are present:
Validate that required environment variables are set:

Automatic system checks

Along with your custom checks, Runpod automatically runs a set of built-in system checks at startup, with no registration required. These verify that the worker has enough memory, disk space, and network connectivity to run reliably. GPU workers run three additional checks that validate the CUDA version, initialize the CUDA device, and benchmark GPU compute. GPU workers also run a native GPU memory allocation test that exercises actual memory allocation across all detected GPUs; this test is skipped automatically on CPU-only workers. You can tune the thresholds for these checks using environment variables, or disable them entirely for testing. Your own registered checks always run, regardless of these settings. The native GPU memory allocation test can be tuned with these additional variables. The test typically takes 100–500 ms per GPU, so keep that in mind when setting RUNPOD_GPU_TEST_TIMEOUT. You can set these variables in your Dockerfile to adjust the thresholds for your workload:
Dockerfile

Disable automatic checks

You can disable the automatic system checks with the following environment variables. This is intended for testing only and is not recommended in production, since the checks help catch unhealthy workers before they take traffic. Your own registered checks still run even when these flags are set.

Test fitness checks locally

Fitness checks don’t run during local testing, so to verify yours before you deploy, call each check function directly. A check signals failure by raising an exception, so you can call it and handle the result yourself.
test_fitness.py
Don’t use the runner, run_fitness_checks(), to test for failures. When a check fails, the runner force-kills the worker by calling os._exit(1), which terminates the process immediately. It doesn’t raise a catchable exception, and it skips any except or finally blocks. Call your check functions directly instead, as shown above.

Best practices

Keep your checks fast and focused on validating readiness, rather than doing heavy work like training models or processing large datasets. Use clear, descriptive error messages so failures are easy to diagnose from the logs. Keep in mind that fitness checks only validate the worker at startup; to catch problems that arise while processing jobs, add health checks and logging inside your handler as well.