mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-08 03:10:26 +00:00
Inherit Petri container defaults and preserve resource overrides
This commit is contained in:
parent
c6464fb646
commit
cae2a7fcdd
3 changed files with 32 additions and 23 deletions
30
Cargo.lock
generated
30
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
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#e0e48d6d7f6b6af86e52a25e6abaf250f36874e6"
|
||||
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#9925996f8ce751a38fe03b03723fff869a8eb153"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"petri-driver",
|
||||
|
|
|
|||
|
|
@ -59,9 +59,7 @@ use petri_execution::{
|
|||
use petri_runtime::driver::lifecycle::ExecutionHooks;
|
||||
pub use petri_runtime::executor::Retention;
|
||||
use petri_runtime::executor::SecretProvider;
|
||||
use petri_runtime::{
|
||||
DaytonaResources, DaytonaSandboxKind, LostSandbox, RunOptions, SandboxBackend,
|
||||
};
|
||||
use petri_runtime::{DaytonaResources, LostSandbox, RunOptions, SandboxBackend};
|
||||
use tokio::fs;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use tracing::{debug, info, warn};
|
||||
|
|
@ -192,9 +190,6 @@ pub async fn run(request: RunRequest) -> Result<RunOutcome, RunError> {
|
|||
options.run_key = Some(key.clone());
|
||||
options.retention = RETENTION;
|
||||
options.sandbox.backend = backend;
|
||||
// Fabro runs on Daytona's generally available containers; Petri's VM
|
||||
// default requires runner capacity that ordinary accounts may not have.
|
||||
options.sandbox.daytona_kind = DaytonaSandboxKind::Container;
|
||||
if backend == SandboxBackend::Daytona {
|
||||
options.sandbox.daytona_resources = daytona_resources(&request.resources)?;
|
||||
}
|
||||
|
|
@ -406,7 +401,7 @@ fn error_chain(error: &RunError) -> String {
|
|||
parts.join(": ")
|
||||
}
|
||||
|
||||
/// Keep the configured allocation, leaving an unspecified disk to Daytona.
|
||||
/// Overlay Fabro's configured allocation on Petri's runner defaults.
|
||||
fn daytona_resources(
|
||||
settings: &EnvironmentResourcesSettings,
|
||||
) -> Result<DaytonaResources, RunError> {
|
||||
|
|
@ -420,7 +415,7 @@ fn daytona_resources(
|
|||
memory_mb: settings
|
||||
.memory
|
||||
.map_or(defaults.memory_mb, daytona_mebibytes),
|
||||
disk_mb: settings.disk.map(daytona_mebibytes),
|
||||
disk_mb: settings.disk.map(daytona_mebibytes).or(defaults.disk_mb),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,20 @@ async fn daytona_runs_forward_configured_resources_in_provider_units() {
|
|||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn daytona_accepts_an_explicit_disk_matching_the_provider_default() {
|
||||
assert_snapshot_request(
|
||||
EnvironmentResourcesSettings {
|
||||
disk: Some("3GB".parse().unwrap()),
|
||||
..EnvironmentResourcesSettings::default()
|
||||
},
|
||||
2,
|
||||
4,
|
||||
Some(3),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn daytona_decimal_memory_meets_the_runner_minimum_without_defaulting_disk() {
|
||||
assert_snapshot_request(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue