runcloud 0.2.239 → 0.2.240

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.
@@ -157,6 +157,18 @@ function parseMemoryLimitMb(value) {
157
157
  }
158
158
  return n;
159
159
  }
160
+ function parseCpuLimitCores(value) {
161
+ const n = Number(value);
162
+ if (!Number.isFinite(n) || n <= 0 || n > 32) {
163
+ throw new InvalidArgumentError('--cpu-limit must be a number of cores above 0 and at most 32, e.g. 2');
164
+ }
165
+ return n;
166
+ }
167
+ function assertCpuLimit(cpuLimit, cpu) {
168
+ if (cpuLimit !== undefined && cpu !== undefined && cpuLimit < cpu) {
169
+ throw new Error(`--cpu-limit (${cpuLimit}) must not be below --cpu (${cpu})`);
170
+ }
171
+ }
160
172
  function assertMemoryLimit(memoryLimit, memory) {
161
173
  if (memoryLimit !== undefined && memory !== undefined && memoryLimit < memory) {
162
174
  throw new Error(`--memory-limit (${memoryLimit} MiB) must not be below --memory (${memory} MiB)`);
@@ -387,6 +399,7 @@ export function registerSandbox(program) {
387
399
  .option('--name <name>', 'human-readable name; with --expose, the hostname prefix <name>-box.run.cloud')
388
400
  .option('--org <id>', 'billing and ownership organization')
389
401
  .option('--cpu <cores>', 'fractional vCPU allocation, e.g. 0.5', parseCpuCores)
402
+ .option('--cpu-limit <cores>', 'CPU the sandbox may burst to above --cpu when its host has room; CPU above --cpu is billed as burst', parseCpuLimitCores)
390
403
  .option('--memory <mb>', 'memory allocation in MiB', parseMemoryMb)
391
404
  .option('--memory-limit <mb>', 'memory the sandbox may use above --memory when its host has room, in MiB; memory above --memory is billed as used', parseMemoryLimitMb)
392
405
  .option('--disk <gb>', 'root disk capacity in GiB', parseDiskGb)
@@ -428,6 +441,9 @@ export function registerSandbox(program) {
428
441
  assertMemoryLimit(opts.memoryLimit, memory);
429
442
  if (opts.memoryLimit !== undefined)
430
443
  body.memoryLimit = opts.memoryLimit;
444
+ assertCpuLimit(opts.cpuLimit, cpu);
445
+ if (opts.cpuLimit !== undefined)
446
+ body.cpuLimit = opts.cpuLimit;
431
447
  if (opts.disk !== undefined)
432
448
  body.disk = opts.disk;
433
449
  const persistent = exposed || opts.persistent || opts.idlePause === 0;
@@ -848,6 +864,7 @@ export function registerSandbox(program) {
848
864
  .option('--name <name>', 'human-readable name for the new sandbox')
849
865
  .option('--size <size>', 'size preset for the restored sandbox')
850
866
  .option('--cpu <cores>', 'CPU cores, including fractional values', parseCpuCores)
867
+ .option('--cpu-limit <cores>', 'CPU the fork may burst to above its CPU when its host has room; CPU above it is billed as burst', parseCpuLimitCores)
851
868
  .option('--memory <mb>', 'memory in MiB', parseMemoryMb)
852
869
  .option('--memory-limit <mb>', 'memory the fork may use above its memory when its host has room, in MiB; memory above it is billed as used', parseMemoryLimitMb)
853
870
  .option('--disk <gb>', 'root disk capacity in GiB (may only grow)', parseDiskGb)
@@ -868,6 +885,9 @@ export function registerSandbox(program) {
868
885
  assertMemoryLimit(opts.memoryLimit, opts.memory);
869
886
  if (opts.memoryLimit !== undefined)
870
887
  body.memoryLimit = opts.memoryLimit;
888
+ assertCpuLimit(opts.cpuLimit, opts.cpu);
889
+ if (opts.cpuLimit !== undefined)
890
+ body.cpuLimit = opts.cpuLimit;
871
891
  if (opts.disk !== undefined)
872
892
  body.disk = opts.disk;
873
893
  if (opts.region)
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.239';
1
+ export const CLI_VERSION = '0.2.240';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.239",
3
+ "version": "0.2.240",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
index 265a594..3802c7c 100644
Binary file