Class: Daytona::Resources

Inherits:
Object
  • Object
show all
Defined in:
lib/daytona/common/resources.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cpu: nil, memory: nil, disk: nil, gpu: nil) ⇒ Resources

Returns a new instance of Resources.

Parameters:

  • cpu (Integer, nil) (defaults to: nil)

    Number of CPU cores to allocate

  • memory (Integer, nil) (defaults to: nil)

    Amount of memory in GiB to allocate

  • disk (Integer, nil) (defaults to: nil)

    Amount of disk space in GiB to allocate

  • gpu (Integer, nil) (defaults to: nil)

    Number of GPUs to allocate



24
25
26
27
28
29
# File 'lib/daytona/common/resources.rb', line 24

def initialize(cpu: nil, memory: nil, disk: nil, gpu: nil)
  @cpu = cpu
  @memory = memory
  @disk = disk
  @gpu = gpu
end

Instance Attribute Details

#cpuInteger? (readonly)

Returns Number of CPU cores to allocate.

Returns:

  • (Integer, nil)

    Number of CPU cores to allocate



9
10
11
# File 'lib/daytona/common/resources.rb', line 9

def cpu
  @cpu
end

#diskInteger? (readonly)

Returns Amount of disk space in GiB to allocate.

Returns:

  • (Integer, nil)

    Amount of disk space in GiB to allocate



15
16
17
# File 'lib/daytona/common/resources.rb', line 15

def disk
  @disk
end

#gpuInteger? (readonly)

Returns Number of GPUs to allocate.

Returns:

  • (Integer, nil)

    Number of GPUs to allocate



18
19
20
# File 'lib/daytona/common/resources.rb', line 18

def gpu
  @gpu
end

#memoryInteger? (readonly)

Returns Amount of memory in GiB to allocate.

Returns:

  • (Integer, nil)

    Amount of memory in GiB to allocate



12
13
14
# File 'lib/daytona/common/resources.rb', line 12

def memory
  @memory
end

Instance Method Details

#to_hHash

Returns Hash representation of the resources.

Returns:

  • (Hash)

    Hash representation of the resources



32
# File 'lib/daytona/common/resources.rb', line 32

def to_h = { cpu:, memory:, disk:, gpu: }.compact