@alienplatform/core 3.3.50 → 3.3.52
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.
- package/dist/index.d.ts +1256 -1225
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3572,6 +3572,9 @@ const MachineProfileSchema = z$2.object({
|
|
|
3572
3572
|
* @description Capacity group definition.\n\nA capacity group represents machines with identical hardware profiles.\nEach group becomes a separate Auto Scaling Group (AWS), Managed Instance Group (GCP),\nor VM Scale Set (Azure).
|
|
3573
3573
|
*/
|
|
3574
3574
|
const CapacityGroupSchema = z$2.object({
|
|
3575
|
+
get "dataDiskGibRange"() {
|
|
3576
|
+
return z$2.union([ComputeChoiceRangeSchema, z$2.null()]).optional();
|
|
3577
|
+
},
|
|
3575
3578
|
"groupId": z$2.string().describe("Unique identifier for this capacity group (must be lowercase alphanumeric with hyphens)"),
|
|
3576
3579
|
"instanceType": z$2.string().describe("Provider machine selected at deployment time.\n`alien.ts` should declare portable requirements; preflight materialization\nfills this field from `StackSettings.compute`.").nullish(),
|
|
3577
3580
|
"maxSize": z$2.int().min(0).describe("Maximum number of machines (must be ≤ 10)"),
|
|
@@ -3896,7 +3899,7 @@ const PermissionProfileSchema = z$2.object({}).catchall(z$2.array(z$2.lazy(() =>
|
|
|
3896
3899
|
* Do not edit manually.
|
|
3897
3900
|
*/
|
|
3898
3901
|
/**
|
|
3899
|
-
* @description ComputeCluster resource for running long-running container workloads.\n\nA ComputeCluster provides the setup-owned machine boundary for containers.\nAlien may manage the worker fleet inside that boundary when setup grants\n`compute-cluster/management`.\n\n## Architecture\n\n- **Setup** creates cloud resources: ASGs/MIGs/VMSSs, IAM roles, security groups\n- **Alien** manages allowed fleet operations: machine count, runtime\n machine image rollout and, on AWS, the machine type within one CPU architecture\n- A node agent runs on each machine from the selected runtime image channel\n\n## Example\n\n```rust\nuse alien_core::{CapacityGroup, ComputeCluster, MachineProfile};\n\nlet cluster = ComputeCluster::new(\"compute\".to_string())\n .capacity_group(CapacityGroup {\n group_id: \"general\".to_string(),\n instance_type: None,\n profile: Some(MachineProfile {\n cpu: \"4.0\".to_string(),\n memory_bytes: 16 * 1024 * 1024 * 1024,\n ephemeral_storage_bytes: 20 * 1024 * 1024 * 1024,\n architecture: None,\n gpu: None,\n data_disk: None,\n }),\n min_size: 1,\n max_size: 5,\n scale_policy: None,\n nested_virtualization: None,\n })\n .build();\n```
|
|
3902
|
+
* @description ComputeCluster resource for running long-running container workloads.\n\nA ComputeCluster provides the setup-owned machine boundary for containers.\nAlien may manage the worker fleet inside that boundary when setup grants\n`compute-cluster/management`.\n\n## Architecture\n\n- **Setup** creates cloud resources: ASGs/MIGs/VMSSs, IAM roles, security groups\n- **Alien** manages allowed fleet operations: machine count, runtime\n machine image rollout and, on AWS, the machine type within one CPU architecture\n- A node agent runs on each machine from the selected runtime image channel\n\n## Example\n\n```rust\nuse alien_core::{CapacityGroup, ComputeCluster, MachineProfile};\n\nlet cluster = ComputeCluster::new(\"compute\".to_string())\n .capacity_group(CapacityGroup {\n group_id: \"general\".to_string(),\n instance_type: None,\n profile: Some(MachineProfile {\n cpu: \"4.0\".to_string(),\n memory_bytes: 16 * 1024 * 1024 * 1024,\n ephemeral_storage_bytes: 20 * 1024 * 1024 * 1024,\n architecture: None,\n gpu: None,\n data_disk: None,\n }),\n min_size: 1,\n max_size: 5,\n scale_policy: None,\n nested_virtualization: None,\n data_disk_gib_range: None,\n })\n .build();\n```
|
|
3900
3903
|
*/
|
|
3901
3904
|
const ComputeClusterSchema = z$2.object({
|
|
3902
3905
|
get "capacityGroups"() {
|
|
@@ -3913,7 +3916,7 @@ const ComputeClusterSchema = z$2.object({
|
|
|
3913
3916
|
return z$2.array(PlatformSchema.describe("Represents the target cloud platform.")).describe("Cloud platforms on which the explicit node grants apply; absent applies everywhere.").nullish();
|
|
3914
3917
|
},
|
|
3915
3918
|
"selectedFailureDomains": z$2.optional(z$2.object({}).catchall(z$2.array(z$2.string())).describe("Concrete provider failure domains selected during setup, keyed by capacity group.\nEmpty preserves the existing aggregate layout when no spread policy is configured."))
|
|
3916
|
-
}).describe("ComputeCluster resource for running long-running container workloads.\n\nA ComputeCluster provides the setup-owned machine boundary for containers.\nAlien may manage the worker fleet inside that boundary when setup grants\n`compute-cluster/management`.\n\n## Architecture\n\n- **Setup** creates cloud resources: ASGs/MIGs/VMSSs, IAM roles, security groups\n- **Alien** manages allowed fleet operations: machine count, runtime\n machine image rollout and, on AWS, the machine type within one CPU architecture\n- A node agent runs on each machine from the selected runtime image channel\n\n## Example\n\n```rust\nuse alien_core::{CapacityGroup, ComputeCluster, MachineProfile};\n\nlet cluster = ComputeCluster::new(\"compute\".to_string())\n .capacity_group(CapacityGroup {\n group_id: \"general\".to_string(),\n instance_type: None,\n profile: Some(MachineProfile {\n cpu: \"4.0\".to_string(),\n memory_bytes: 16 * 1024 * 1024 * 1024,\n ephemeral_storage_bytes: 20 * 1024 * 1024 * 1024,\n architecture: None,\n gpu: None,\n data_disk: None,\n }),\n min_size: 1,\n max_size: 5,\n scale_policy: None,\n nested_virtualization: None,\n })\n .build();\n```");
|
|
3919
|
+
}).describe("ComputeCluster resource for running long-running container workloads.\n\nA ComputeCluster provides the setup-owned machine boundary for containers.\nAlien may manage the worker fleet inside that boundary when setup grants\n`compute-cluster/management`.\n\n## Architecture\n\n- **Setup** creates cloud resources: ASGs/MIGs/VMSSs, IAM roles, security groups\n- **Alien** manages allowed fleet operations: machine count, runtime\n machine image rollout and, on AWS, the machine type within one CPU architecture\n- A node agent runs on each machine from the selected runtime image channel\n\n## Example\n\n```rust\nuse alien_core::{CapacityGroup, ComputeCluster, MachineProfile};\n\nlet cluster = ComputeCluster::new(\"compute\".to_string())\n .capacity_group(CapacityGroup {\n group_id: \"general\".to_string(),\n instance_type: None,\n profile: Some(MachineProfile {\n cpu: \"4.0\".to_string(),\n memory_bytes: 16 * 1024 * 1024 * 1024,\n ephemeral_storage_bytes: 20 * 1024 * 1024 * 1024,\n architecture: None,\n gpu: None,\n data_disk: None,\n }),\n min_size: 1,\n max_size: 5,\n scale_policy: None,\n nested_virtualization: None,\n data_disk_gib_range: None,\n })\n .build();\n```");
|
|
3917
3920
|
// src/generated/zod/failure-domain-selection-schema.ts
|
|
3918
3921
|
/**
|
|
3919
3922
|
* Generated by Kubb (https://kubb.dev/).
|
|
@@ -3935,6 +3938,7 @@ const FailureDomainSelectionSchema = z$2.object({
|
|
|
3935
3938
|
* @description User-selected deployment settings for one compute pool.
|
|
3936
3939
|
*/
|
|
3937
3940
|
const ComputePoolSelectionSchema = z$2.union([z$2.object({
|
|
3941
|
+
"dataDiskGib": z$2.int().min(0).describe("Data disk size per machine, in whole GiB, within the pool's declared\nrange. Omitted uses the release default; 0 runs the pool without one.").nullish(),
|
|
3938
3942
|
get "failure_domains"() {
|
|
3939
3943
|
return z$2.union([FailureDomainSelectionSchema, z$2.null()]).optional();
|
|
3940
3944
|
},
|
|
@@ -3942,6 +3946,7 @@ const ComputePoolSelectionSchema = z$2.union([z$2.object({
|
|
|
3942
3946
|
"machines": z$2.int().min(0).describe("Number of machines to run."),
|
|
3943
3947
|
"mode": z$2.enum(["fixed"])
|
|
3944
3948
|
}), z$2.object({
|
|
3949
|
+
"dataDiskGib": z$2.int().min(0).describe("Data disk size per machine, in whole GiB, within the pool's declared\nrange. Omitted uses the release default; 0 runs the pool without one.").nullish(),
|
|
3945
3950
|
get "failure_domains"() {
|
|
3946
3951
|
return z$2.union([FailureDomainSelectionSchema, z$2.null()]).optional();
|
|
3947
3952
|
},
|
|
@@ -9691,13 +9696,15 @@ var ComputeCluster = class extends ResourceMetadataBuilder {
|
|
|
9691
9696
|
}
|
|
9692
9697
|
if (config.failureDomainSpread !== void 0 && (!Number.isInteger(config.failureDomainSpread) || config.failureDomainSpread < 1 || config.failureDomainSpread > 255)) throw new Error("Compute pool failureDomainSpread must be an integer from 1 to 255");
|
|
9693
9698
|
const { minSize, maxSize } = selectedScaleBounds(config.scale);
|
|
9699
|
+
const dataDiskGibRange = dataDiskRangeFromRequirements(config.requirements);
|
|
9694
9700
|
this._config.capacityGroups.push({
|
|
9695
9701
|
groupId,
|
|
9696
|
-
profile: machineProfileFromRequirements(config.requirements),
|
|
9702
|
+
profile: machineProfileFromRequirements(config.requirements, dataDiskGibRange),
|
|
9697
9703
|
minSize,
|
|
9698
9704
|
maxSize,
|
|
9699
9705
|
scalePolicy: scalePolicyFromInput(config.scale),
|
|
9700
|
-
nestedVirtualization: config.requirements.nestedVirtualization
|
|
9706
|
+
nestedVirtualization: config.requirements.nestedVirtualization,
|
|
9707
|
+
dataDiskGibRange
|
|
9701
9708
|
});
|
|
9702
9709
|
if (config.failureDomainSpread !== void 0) {
|
|
9703
9710
|
this._config.failureDomainSpread ??= {};
|
|
@@ -9763,7 +9770,25 @@ function defaultChoice(choice) {
|
|
|
9763
9770
|
if (typeof choice === "number") return choice;
|
|
9764
9771
|
return choice.default;
|
|
9765
9772
|
}
|
|
9766
|
-
function
|
|
9773
|
+
function dataDiskRangeFromRequirements(requirements) {
|
|
9774
|
+
const size = requirements.dataDisk?.size;
|
|
9775
|
+
if (size === void 0 || typeof size === "string") return;
|
|
9776
|
+
const range = {
|
|
9777
|
+
min: parseWholeGib("dataDisk.size.min", size.min),
|
|
9778
|
+
max: parseWholeGib("dataDisk.size.max", size.max),
|
|
9779
|
+
default: parseWholeGib("dataDisk.size.default", size.default)
|
|
9780
|
+
};
|
|
9781
|
+
if (!(range.min <= range.default && range.default <= range.max)) throw new Error(`Compute pool dataDisk.size needs min <= default <= max: ${size.min}, ${size.default}, ${size.max}`);
|
|
9782
|
+
if (range.max === 0) throw new Error("Compute pool dataDisk.size.max must be greater than zero");
|
|
9783
|
+
return range;
|
|
9784
|
+
}
|
|
9785
|
+
function parseWholeGib(field, value) {
|
|
9786
|
+
const gib = parseQuantityBytes(value) / 1024 ** 3;
|
|
9787
|
+
if (!Number.isInteger(gib)) throw new Error(`Compute pool ${field} must be a whole number of GiB: ${value}`);
|
|
9788
|
+
return gib;
|
|
9789
|
+
}
|
|
9790
|
+
function machineProfileFromRequirements(requirements, dataDiskGibRange) {
|
|
9791
|
+
const dataDisk = dataDiskFromRequirements(requirements, dataDiskGibRange);
|
|
9767
9792
|
return {
|
|
9768
9793
|
cpu: typeof requirements.cpu === "number" ? `${requirements.cpu}` : requirements.cpu,
|
|
9769
9794
|
memoryBytes: parseQuantityBytes(requirements.memory),
|
|
@@ -9773,9 +9798,16 @@ function machineProfileFromRequirements(requirements) {
|
|
|
9773
9798
|
type: requirements.accelerators[0].type,
|
|
9774
9799
|
count: requirements.accelerators[0].count
|
|
9775
9800
|
} : void 0,
|
|
9776
|
-
dataDisk
|
|
9801
|
+
dataDisk
|
|
9777
9802
|
};
|
|
9778
9803
|
}
|
|
9804
|
+
/** The declared size, or a range's default; a default of 0 means no data disk. */
|
|
9805
|
+
function dataDiskFromRequirements(requirements, dataDiskGibRange) {
|
|
9806
|
+
const size = requirements.dataDisk?.size;
|
|
9807
|
+
if (size === void 0) return;
|
|
9808
|
+
if (dataDiskGibRange) return dataDiskGibRange.default > 0 ? { sizeBytes: dataDiskGibRange.default * 1024 ** 3 } : void 0;
|
|
9809
|
+
return { sizeBytes: parsePositiveQuantityBytes("dataDisk.size", size) };
|
|
9810
|
+
}
|
|
9779
9811
|
function parsePositiveQuantityBytes(field, value) {
|
|
9780
9812
|
const bytes = parseQuantityBytes(value);
|
|
9781
9813
|
if (bytes <= 0) throw new Error(`Compute pool ${field} must be greater than zero: ${value}`);
|