#![cfg(any(feature = "monty", feature = "monty-pool"))]
use monty_types::{OsPolicy, ResourceLimits, SleepMode};
use crate::sandbox::Limits;
#[cfg(feature = "monty")]
pub use self::in_process::Monty;
#[cfg(feature = "monty-pool")]
pub use self::pool::{MontyPool, WorkerOptions};
#[cfg(feature = "monty")]
mod in_process;
#[cfg(feature = "monty-pool")]
mod pool;
mod value;
const SCRIPT_NAME: &str = "script.py";
const DUMP_HOLDS_RUN: &str = "the dump holds a run, and ghostmode restores only an idle session";
const TOOLS_NOT_AWAITABLE: &str = "tools are not awaitable";
fn to_resource_limits(limits: &Limits) -> ResourceLimits {
ResourceLimits {
max_feed_duration: Some(limits.run_time),
max_memory: Some(limits.memory_bytes),
max_recursion_depth: limits.recursion_depth,
max_suspensions: usize::MAX,
..ResourceLimits::default()
}
}
fn build_os_policy() -> OsPolicy {
OsPolicy {
sleep: SleepMode::Zero,
..OsPolicy::default()
}
}