daytona 0.204.0 → 0.205.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9262546e49c3718967e3a0300303d4a29307bf48e05d3858adbbd64ed3c5476
4
- data.tar.gz: f7292a5cb930340df80595e497782a28fab1beb9bb3bbb5b8147a52ed8a4c952
3
+ metadata.gz: ba9a97a7af09b8d505de9b5d107a764c5e150e21c5b336bd732f5ff8d98341cb
4
+ data.tar.gz: 22057c0b0bd750faa8403fed0b52716ff423d0223cbfc8059935a412bc127f2f
5
5
  SHA512:
6
- metadata.gz: 5ea724b9fd64d2efc919c764b7236b008e4eeda909b1796d0c05b91e31085cc379fe7a8215949ec1d0f8de40851a045edffd9aaabdfa13767d2346567876ef18
7
- data.tar.gz: 44b45171c7a2d21e1060c52f85ef90a9379d10ddaeaf5bd4b66ecd3dd097ba6cfe1b67ec86e8feb00cdd96bd25853ef82e8bcd35b53db3e395fcc39b04199420
6
+ metadata.gz: e66d5b8c8a2b3e11468840705f4bbc8c199ece6639047c9cbab4e0c69981740a413f474ea1a18b3162963e5c599aced27878f963899b4f890094f51000baa885
7
+ data.tar.gz: 888b3b55cdaded8230e1662816eb4b8bea4541737025da1796d997cd619d1438b6108d138a6e09f19fe0956e37d6c3a2ff47bf5ea55289184c97d703ea18a252
@@ -59,12 +59,20 @@ module Daytona
59
59
  # @return [String, nil] Outbound proxy URL to route the Sandbox HTTP(S) traffic through
60
60
  attr_accessor :outbound_proxy_url
61
61
 
62
+ # @return [String, nil] OTel collector endpoint override for the Sandbox
63
+ attr_accessor :otel_endpoint_override
64
+
62
65
  # @return [Integer, nil] Time to live in minutes (0 to disable)
63
66
  attr_accessor :ttl_minutes
64
67
 
65
68
  # @return [Boolean, nil] Whether the Sandbox should be ephemeral
66
69
  attr_accessor :ephemeral
67
70
 
71
+ # @return [Boolean, nil] GPU-only. When true, the Sandbox may be instantly terminated without notice
72
+ # to free GPU capacity for an on-demand (non-spot) GPU Sandbox. Rejected when the Sandbox
73
+ # requests no GPUs.
74
+ attr_accessor :spot
75
+
68
76
  # @return [String, nil] ID or name of an existing Sandbox to link the new Sandbox to. The new
69
77
  # Sandbox will be scheduled on the same runner as the linked Sandbox so a local network can be
70
78
  # established between them. Linked Sandboxes must be
@@ -92,8 +100,13 @@ module Daytona
92
100
  # @param outbound_proxy_url [String, nil] Outbound proxy URL to route the Sandbox HTTP(S) traffic through.
93
101
  # Applied via the HTTP(S)_PROXY environment variables; combine with domain_allow_list for
94
102
  # network-layer enforcement.
103
+ # @param otel_endpoint_override [String, nil] OTel collector endpoint override for the Sandbox. When set,
104
+ # sandbox OTel data is sent to this endpoint instead of the default collector and will not be
105
+ # available in the Daytona analytics API or dashboard.
95
106
  # @param ttl_minutes [Integer, nil] Time to live in minutes (0 to disable)
96
107
  # @param ephemeral [Boolean, nil] Whether the Sandbox should be ephemeral
108
+ # @param spot [Boolean, nil] GPU-only. Whether the Sandbox may be instantly terminated to free GPU
109
+ # capacity for an on-demand GPU Sandbox
97
110
  # @param linked_sandbox [String, nil] ID or name of an existing Sandbox to link the new Sandbox to
98
111
  def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
99
112
  language: nil,
@@ -113,7 +126,9 @@ module Daytona
113
126
  network_allow_list: nil,
114
127
  domain_allow_list: nil,
115
128
  outbound_proxy_url: nil,
129
+ otel_endpoint_override: nil,
116
130
  ephemeral: nil,
131
+ spot: nil,
117
132
  linked_sandbox: nil
118
133
  )
119
134
  @language = language
@@ -133,7 +148,9 @@ module Daytona
133
148
  @network_allow_list = network_allow_list
134
149
  @domain_allow_list = domain_allow_list
135
150
  @outbound_proxy_url = outbound_proxy_url
151
+ @otel_endpoint_override = otel_endpoint_override
136
152
  @ephemeral = ephemeral
153
+ @spot = spot
137
154
  @linked_sandbox = linked_sandbox
138
155
 
139
156
  # Handle ephemeral and auto_delete_interval conflict
@@ -162,7 +179,9 @@ module Daytona
162
179
  network_allow_list:,
163
180
  domain_allow_list:,
164
181
  outbound_proxy_url:,
182
+ otel_endpoint_override:,
165
183
  ephemeral:,
184
+ spot:,
166
185
  linked_sandbox:
167
186
  }.compact
168
187
  end
@@ -219,6 +238,9 @@ module Daytona
219
238
  # @param outbound_proxy_url [String, nil] Outbound proxy URL to route the Sandbox HTTP(S) traffic through.
220
239
  # Applied via the HTTP(S)_PROXY environment variables; combine with domain_allow_list for
221
240
  # network-layer enforcement.
241
+ # @param otel_endpoint_override [String, nil] OTel collector endpoint override for the Sandbox. When set,
242
+ # sandbox OTel data is sent to this endpoint instead of the default collector and will not be
243
+ # available in the Daytona analytics API or dashboard.
222
244
  # @param ephemeral [Boolean, nil] Whether the Sandbox should be ephemeral
223
245
  def initialize(image:, resources: nil, **args)
224
246
  @image = image
@@ -265,6 +287,9 @@ module Daytona
265
287
  # @param outbound_proxy_url [String, nil] Outbound proxy URL to route the Sandbox HTTP(S) traffic through.
266
288
  # Applied via the HTTP(S)_PROXY environment variables; combine with domain_allow_list for
267
289
  # network-layer enforcement.
290
+ # @param otel_endpoint_override [String, nil] OTel collector endpoint override for the Sandbox. When set,
291
+ # sandbox OTel data is sent to this endpoint instead of the default collector and will not be
292
+ # available in the Daytona analytics API or dashboard.
268
293
  # @param ephemeral [Boolean, nil] Whether the Sandbox should be ephemeral
269
294
  def initialize(snapshot: nil, **args)
270
295
  @snapshot = snapshot
@@ -25,6 +25,9 @@ module Daytona
25
25
  # @return [Daytona::SecretService]
26
26
  attr_reader :secret
27
27
 
28
+ # @return [Daytona::WarmPoolService]
29
+ attr_reader :warm_pool
30
+
28
31
  # @return [DaytonaApiClient::ObjectStorageApi]
29
32
  attr_reader :object_storage_api
30
33
 
@@ -53,6 +56,7 @@ module Daytona
53
56
  @analytics_api_url_mutex = Mutex.new
54
57
  @volume = VolumeService.new(DaytonaApiClient::VolumesApi.new(api_client), otel_state:)
55
58
  @secret = SecretService.new(DaytonaApiClient::SecretApi.new(api_client), otel_state:)
59
+ @warm_pool = WarmPoolService.new(DaytonaApiClient::WarmPoolsApi.new(api_client), otel_state:)
56
60
  @object_storage_api = DaytonaApiClient::ObjectStorageApi.new(api_client)
57
61
  @snapshots_api = DaytonaApiClient::SnapshotsApi.new(api_client)
58
62
  @snapshot = SnapshotService.new(
@@ -290,7 +294,9 @@ module Daytona
290
294
  network_allow_list: params.network_allow_list,
291
295
  domain_allow_list: params.domain_allow_list,
292
296
  outbound_proxy_url: params.outbound_proxy_url,
293
- linked_sandbox: params.linked_sandbox
297
+ otel_endpoint_override: params.otel_endpoint_override,
298
+ linked_sandbox: params.linked_sandbox,
299
+ spot: params.spot
294
300
  )
295
301
 
296
302
  create_sandbox.snapshot = params.snapshot if params.respond_to?(:snapshot)
@@ -101,6 +101,13 @@ module Daytona
101
101
  # @return [Float] The GPU quota for the sandbox
102
102
  attr_reader :gpu
103
103
 
104
+ # @return [Boolean] Whether this is a spot GPU sandbox. Spot sandboxes may be instantly terminated
105
+ # to free capacity for on-demand GPU sandboxes.
106
+ attr_reader :spot
107
+
108
+ # @return [String, nil] When the sandbox was evicted by spot preemption
109
+ attr_reader :spot_evicted_at
110
+
104
111
  # @return [Float] The memory quota for the sandbox
105
112
  attr_reader :memory
106
113
 
@@ -1085,6 +1092,8 @@ module Daytona
1085
1092
  @target = sandbox_dto.target
1086
1093
  @cpu = sandbox_dto.cpu
1087
1094
  @gpu = sandbox_dto.gpu
1095
+ @spot = sandbox_dto.spot || false
1096
+ @spot_evicted_at = sandbox_dto.spot_evicted_at
1088
1097
  @memory = sandbox_dto.memory
1089
1098
  @disk = sandbox_dto.disk
1090
1099
  @desired_state = sandbox_dto.desired_state
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Daytona
7
7
  module Sdk
8
- VERSION = '0.204.0'
8
+ VERSION = '0.205.0'
9
9
  end
10
10
  end
data/lib/daytona/sdk.rb CHANGED
@@ -47,6 +47,8 @@ require_relative 'snapshot_service'
47
47
  require_relative 'util'
48
48
  require_relative 'volume'
49
49
  require_relative 'volume_service'
50
+ require_relative 'warm_pool'
51
+ require_relative 'warm_pool_service'
50
52
  require_relative 'process'
51
53
 
52
54
  module Daytona
@@ -0,0 +1,75 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ # frozen_string_literal: true
5
+
6
+ module Daytona
7
+ # A warm pool of ready-to-use Sandboxes for a snapshot. `current_size` versus
8
+ # `pool` is the pool's status: `current_size` is the number of ready warm
9
+ # sandboxes, `pool` is the desired number. `error_reason` is set when the
10
+ # pool cannot be filled.
11
+ class WarmPool
12
+ # @return [String]
13
+ attr_reader :id
14
+
15
+ # @return [String]
16
+ attr_reader :organization_id
17
+
18
+ # @return [String]
19
+ attr_reader :snapshot
20
+
21
+ # @return [String]
22
+ attr_reader :target
23
+
24
+ # @return [Integer]
25
+ attr_reader :pool
26
+
27
+ # @return [Integer]
28
+ attr_reader :current_size
29
+
30
+ # @return [Integer]
31
+ attr_reader :cpu
32
+
33
+ # @return [Integer]
34
+ attr_reader :mem
35
+
36
+ # @return [Integer]
37
+ attr_reader :disk
38
+
39
+ # @return [String]
40
+ attr_reader :os_user
41
+
42
+ # @return [Hash{String => String}]
43
+ attr_reader :env
44
+
45
+ # @return [String, nil]
46
+ attr_reader :error_reason
47
+
48
+ # @return [String]
49
+ attr_reader :created_at
50
+
51
+ # @return [String]
52
+ attr_reader :updated_at
53
+
54
+ # Initialize warm pool from DTO
55
+ #
56
+ # @param warm_pool_dto [DaytonaApiClient::WarmPool]
57
+ def initialize(warm_pool_dto)
58
+ @id = warm_pool_dto.id
59
+ @organization_id = warm_pool_dto.organization_id
60
+ @snapshot = warm_pool_dto.snapshot
61
+ @target = warm_pool_dto.target
62
+ # The generated client deserializes OpenAPI numbers as Float; these are all integral.
63
+ @pool = warm_pool_dto.pool.to_i
64
+ @current_size = warm_pool_dto.current_size.to_i
65
+ @cpu = warm_pool_dto.cpu.to_i
66
+ @mem = warm_pool_dto.mem.to_i
67
+ @disk = warm_pool_dto.disk.to_i
68
+ @os_user = warm_pool_dto.os_user
69
+ @env = warm_pool_dto.env
70
+ @error_reason = warm_pool_dto.error_reason
71
+ @created_at = warm_pool_dto.created_at
72
+ @updated_at = warm_pool_dto.updated_at
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,61 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ # frozen_string_literal: true
5
+
6
+ module Daytona
7
+ class WarmPoolService
8
+ include Instrumentation
9
+
10
+ # Service for managing Daytona Warm Pools. Can be used to list, create, update and delete Warm Pools.
11
+ #
12
+ # @param warm_pools_api [DaytonaApiClient::WarmPoolsApi]
13
+ # @param otel_state [Daytona::OtelState, nil]
14
+ def initialize(warm_pools_api, otel_state: nil)
15
+ @warm_pools_api = warm_pools_api
16
+ @otel_state = otel_state
17
+ end
18
+
19
+ # Create a new Warm Pool.
20
+ #
21
+ # @param snapshot [String] The snapshot (ID or name) to keep warm sandboxes for
22
+ # @param pool [Integer] Number of warm sandboxes to keep ready
23
+ # @param target [String, nil] Target region; defaults to the organization default region
24
+ # @return [Daytona::WarmPool]
25
+ def create(snapshot, pool, target: nil)
26
+ WarmPool.new(warm_pools_api.create_warm_pool(DaytonaApiClient::CreateWarmPool.new(snapshot:, pool:, target:)))
27
+ end
28
+
29
+ # Delete a Warm Pool.
30
+ #
31
+ # @param warm_pool_id [String]
32
+ # @return [void]
33
+ def delete(warm_pool_id) = warm_pools_api.delete_warm_pool(warm_pool_id)
34
+
35
+ # List all Warm Pools.
36
+ #
37
+ # @return [Array<Daytona::WarmPool>]
38
+ def list
39
+ warm_pools_api.list_warm_pools.map { |warm_pool| WarmPool.new(warm_pool) }
40
+ end
41
+
42
+ # Update the desired size of a Warm Pool.
43
+ #
44
+ # @param warm_pool_id [String]
45
+ # @param pool [Integer] New desired number of warm sandboxes (0 drains the pool)
46
+ # @return [Daytona::WarmPool]
47
+ def update(warm_pool_id, pool)
48
+ WarmPool.new(warm_pools_api.update_warm_pool(warm_pool_id, DaytonaApiClient::UpdateWarmPool.new(pool:)))
49
+ end
50
+
51
+ instrument :create, :delete, :list, :update, component: 'WarmPoolService'
52
+
53
+ private
54
+
55
+ # @return [DaytonaApiClient::WarmPoolsApi]
56
+ attr_reader :warm_pools_api
57
+
58
+ # @return [Daytona::OtelState, nil]
59
+ attr_reader :otel_state
60
+ end
61
+ end
data/project.json CHANGED
@@ -92,7 +92,7 @@
92
92
  "dependsOn": [
93
93
  {
94
94
  "target": "publish",
95
- "projects": ["api-client-ruby", "toolbox-api-client-ruby", "analytics-api-client-ruby"]
95
+ "projects": ["analytics-api-client-ruby"]
96
96
  },
97
97
  "build"
98
98
  ]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daytona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.204.0
4
+ version: 0.205.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daytona Platforms Inc.
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 1980-01-01 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: opentelemetry-exporter-otlp
@@ -85,42 +85,42 @@ dependencies:
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 0.204.0
88
+ version: 0.205.0
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 0.204.0
95
+ version: 0.205.0
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: daytona_api_client
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 0.204.0
102
+ version: 0.205.0
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 0.204.0
109
+ version: 0.205.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: daytona_toolbox_api_client
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 0.204.0
116
+ version: 0.205.0
117
117
  type: :runtime
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 0.204.0
123
+ version: 0.205.0
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: dotenv
126
126
  requirement: !ruby/object:Gem::Requirement
@@ -238,6 +238,8 @@ files:
238
238
  - lib/daytona/utils/file_url_signing.rb
239
239
  - lib/daytona/volume.rb
240
240
  - lib/daytona/volume_service.rb
241
+ - lib/daytona/warm_pool.rb
242
+ - lib/daytona/warm_pool_service.rb
241
243
  - project.json
242
244
  - scripts/generate-docs.rb
243
245
  - sig/daytona/sdk.rbs
@@ -264,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
266
  - !ruby/object:Gem::Version
265
267
  version: '0'
266
268
  requirements: []
267
- rubygems_version: 3.6.9
269
+ rubygems_version: 3.7.2
268
270
  specification_version: 4
269
271
  summary: Ruby SDK for Daytona
270
272
  test_files: []