Skip to content

Resource Override Support for Snapshot-Based Sandboxes #2296

@yomnahisham

Description

@yomnahisham

We are requesting the ability to override CPU, memory, disk, and GPU resources when creating sandboxes from snapshots using CreateSandboxFromSnapshotParams. Currently, resource overrides are only supported for image-based sandboxes via CreateSandboxFromImageParams, which creates a significant limitation for users who need to use pre-built snapshots while still having granular control over resource allocation.

The Daytona SDK currently supports resource allocation in two different ways:

  1. CreateSandboxFromImageParams - Supports resource overrides via the Resources object, but requires pulling Docker images from registries
  2. CreateSandboxFromSnapshotParams - Uses pre-built snapshots (no registry access needed), but does not support resource overrides

This creates a problematic trade-off: users must choose between reliable snapshot-based sandboxes (which don't require registry authentication) and resource control (which requires image-based sandboxes).

I examined both sandbox creation parameter classes:

# CreateSandboxFromImageParams - SUPPORTS resources
from daytona import CreateSandboxFromImageParams
help(CreateSandboxFromImageParams)
# Shows: resources (Optional[Resources]): Resource configuration for the Sandbox

# CreateSandboxFromSnapshotParams - DOES NOT support resources  
from daytona import CreateSandboxFromSnapshotParams
help(CreateSandboxFromSnapshotParams)
# Shows: No resources parameter available

I also checked the base class CreateSandboxBaseParams to confirm that resource support is not inherited:

from daytona import CreateSandboxBaseParams
help(CreateSandboxBaseParams)
# Shows: No resources parameter in base class

I examined the Sandbox class to understand what resource information is available after creation:

from daytona import Sandbox
help(Sandbox)
# Shows attributes: cpu, memory, disk, gpu
# But no methods to modify these after creation

We request adding resource override support to CreateSandboxFromSnapshotParams by:

  • Adding a resources parameter to CreateSandboxFromSnapshotParams with the same type as CreateSandboxFromImageParams
  • Implementing the resource allocation logic in the backend to apply the specified resources when creating sandboxes from snapshots
  • Maintaining backward compatibility - the resources parameter should be optional with the same default behavior as currently exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions