mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-08 03:10:26 +00:00
Delegate Daytona allocation normalization to the driver
This commit is contained in:
parent
d4bb266a52
commit
c7c8e2cf79
2 changed files with 27 additions and 31 deletions
46
Cargo.lock
generated
46
Cargo.lock
generated
|
|
@ -5160,7 +5160,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
|||
[[package]]
|
||||
name = "petri-attractor-steps"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"globset",
|
||||
|
|
@ -5191,7 +5191,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-driver"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"getrandom 0.3.4",
|
||||
|
|
@ -5211,7 +5211,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-engine"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"petri-ir",
|
||||
"serde",
|
||||
|
|
@ -5223,7 +5223,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-execution"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"petri-driver",
|
||||
|
|
@ -5247,7 +5247,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-executor"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"libc",
|
||||
|
|
@ -5262,7 +5262,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-executor-sandbox"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"petri-executor",
|
||||
|
|
@ -5284,7 +5284,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-frontend"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"marked-yaml",
|
||||
"petri-ir",
|
||||
|
|
@ -5298,7 +5298,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-frontend-attractor"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"minijinja",
|
||||
"petri-frontend",
|
||||
|
|
@ -5315,7 +5315,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-frontend-fabro"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"petri-frontend",
|
||||
"petri-frontend-attractor",
|
||||
|
|
@ -5331,7 +5331,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-frontend-native"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"petri-frontend",
|
||||
"petri-ir",
|
||||
|
|
@ -5342,7 +5342,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-ir"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"regex",
|
||||
"serde",
|
||||
|
|
@ -5355,7 +5355,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-runtime"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"petri-driver",
|
||||
|
|
@ -5376,7 +5376,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-steps"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"petri-executor",
|
||||
|
|
@ -5392,7 +5392,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-store"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"getrandom 0.3.4",
|
||||
|
|
@ -5407,7 +5407,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "petri-testkit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e9ed5528eb93d36d55939bff611446ab81d6b0b4"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#58f910709e77f297b4c819f200d509df51dd91d4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"petri-driver",
|
||||
|
|
@ -6287,7 +6287,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sandbox-driver"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#236196ed134dd594e7678e38ebbe968097f1935c"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#b6b5c9c207a510e41c01bcbce4203f489bf734fc"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"globset",
|
||||
|
|
@ -6304,7 +6304,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sandbox-driver-daytona"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#236196ed134dd594e7678e38ebbe968097f1935c"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#b6b5c9c207a510e41c01bcbce4203f489bf734fc"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -6332,7 +6332,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sandbox-driver-daytona-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#236196ed134dd594e7678e38ebbe968097f1935c"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#b6b5c9c207a510e41c01bcbce4203f489bf734fc"
|
||||
dependencies = [
|
||||
"sandbox-driver-docker-config",
|
||||
"serde",
|
||||
|
|
@ -6342,7 +6342,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sandbox-driver-docker"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#236196ed134dd594e7678e38ebbe968097f1935c"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#b6b5c9c207a510e41c01bcbce4203f489bf734fc"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -6363,7 +6363,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sandbox-driver-docker-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#236196ed134dd594e7678e38ebbe968097f1935c"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#b6b5c9c207a510e41c01bcbce4203f489bf734fc"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
@ -6372,7 +6372,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sandbox-driver-host"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#236196ed134dd594e7678e38ebbe968097f1935c"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#b6b5c9c207a510e41c01bcbce4203f489bf734fc"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -6390,7 +6390,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sandbox-driver-protocol"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#236196ed134dd594e7678e38ebbe968097f1935c"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#b6b5c9c207a510e41c01bcbce4203f489bf734fc"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64",
|
||||
|
|
@ -6407,7 +6407,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sandbox-driver-testing"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#236196ed134dd594e7678e38ebbe968097f1935c"
|
||||
source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#b6b5c9c207a510e41c01bcbce4203f489bf734fc"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"sandbox-driver",
|
||||
|
|
|
|||
|
|
@ -412,17 +412,13 @@ fn daytona_resources(
|
|||
.map(|cpu| u32::try_from(cpu).map_err(|_| RunError::InvalidCpu { cpu }))
|
||||
.transpose()?
|
||||
.unwrap_or(defaults.cpu_cores),
|
||||
memory_mb: settings
|
||||
.memory
|
||||
.map_or(defaults.memory_mb, daytona_mebibytes),
|
||||
disk_mb: settings.disk.map(daytona_mebibytes).or(defaults.disk_mb),
|
||||
memory_mb: settings.memory.map_or(defaults.memory_mb, mebibytes),
|
||||
disk_mb: settings.disk.map(mebibytes).or(defaults.disk_mb),
|
||||
})
|
||||
}
|
||||
|
||||
fn daytona_mebibytes(size: Size) -> u64 {
|
||||
// Daytona allocates whole GiB. Round up as the driver does before
|
||||
// Petri validates the minimum and compares the resolved snapshot size.
|
||||
size.as_bytes().div_ceil(1024 * 1024 * 1024) * 1024
|
||||
fn mebibytes(size: Size) -> u64 {
|
||||
size.as_bytes().div_ceil(1024 * 1024)
|
||||
}
|
||||
|
||||
/// The sandbox backend for Fabro's provider kind; `None` for a kind Petri
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue