Container-Based Task Creation
Container-Based Task Creation
A container task runs a Docker image on a GPU instance until the process exits. Use this approach for training jobs, batch inference, data processing, or any workload that runs to completion.
Container requirements
NVCT does not impose a server or health check requirement. The container only needs to:
- Perform its workload.
- Exit with code 0 on success, or a non-zero code on failure.
GPU drivers and CUDA libraries are available on the host. Use an image based on an appropriate CUDA base image for your workload.
Creating a container task
Result upload to a registry is not supported on self-hosted NVCF. Always set
resultHandlingStrategy to NONE. Omitting it defaults to UPLOAD, which
will be rejected at creation time.
Example JSON configuration
Environment variables
The task system injects the following environment variables into the container:
GPU specification
Runtime limits
A task that exceeds maxRuntimeDuration moves to
EXCEEDED_MAX_RUNTIME_DURATION status. A task that is not scheduled within
maxQueuedDuration moves to EXCEEDED_MAX_QUEUED_DURATION status.
maxRuntimeDuration has no default or maximum: omit it and the task runs with
no time limit.
Secrets
Secrets are delivered to the container as a JSON file at
/var/secrets/secrets.json. The file has the form:
Provide secrets via --secrets NAME=value on the CLI or as a secrets array
in the JSON file. Secret values are stored encrypted and are not returned by
default in task detail responses.
To rotate secrets on a running task, use update-secrets. The file at
/var/secrets/secrets.json is refreshed automatically with the new values:
Model and resource artifacts
Attach model or resource artifacts to a task using the --models and
--resources flags (format: name:version:uri) or via the JSON models and
resources arrays. The task system downloads and mounts them before the
container starts:
- Models are available at
/config/models/{modelName} - Resources are available at
/config/resources/{resourceName}
Progress file
The progress file is the primary mechanism for signaling task progress and
completion. The task system reads it to determine whether the container is alive
and when to transition the task to COMPLETED.
The container must write a JSON object to NVCT_PROGRESS_FILE_PATH:
Field requirements:
Heartbeat: If lastUpdatedAt falls more than 5 minutes behind the current
time and percentComplete is not 100, the task moves to ERRORED.
Completion: Set percentComplete to 100 when the workload finishes. That
write transitions the task to COMPLETED. A container that exits without
writing 100 will not reach COMPLETED.
Intermediate results: For checkpoints or partial outputs, write
percentComplete between 1 and 99 with a name for each checkpoint. When
using UPLOAD, each checkpoint name must be unique and you must not write to
a result directory after updating name to a new value, since the system reads
resultsDir to upload files by name. With NONE, there is no write-ordering
constraint on the results directory.
Atomic writes: Write to a temporary file and rename it over
NVCT_PROGRESS_FILE_PATH to avoid the task system reading a partial file.
In Python: os.rename(tmp_path, progress_path).
Result handling
Result upload to a registry is not supported on self-hosted NVCF in this
release. Set resultHandlingStrategy to NONE.
With NONE, the container is responsible for delivering its own outputs —
for example, writing to a volume or pushing to external storage using
credentials from task secrets. The task system does not upload anything but
still tracks progress through the progress file.
After the task completes, list any result names the container reported:
Monitoring a task
A task get response includes percentComplete and healthInfo (the GPU type,
instance type, and any error message from the platform) in addition to the
lifecycle status.
To stop a running or queued task: