pub struct TaskWorkspace { /* private fields */ }Expand description
An isolated workspace for running a benchmark task.
The workspace is created in a temporary directory with:
- Its own
.gitdirectory (isolated from main repo) - A fresh
.ralph/agent/scratchpad.md - Copied setup files from the task definition
Implementations§
Source§impl TaskWorkspace
impl TaskWorkspace
Sourcepub fn create(
task: &TaskDefinition,
base_dir: &Path,
) -> Result<Self, WorkspaceError>
pub fn create( task: &TaskDefinition, base_dir: &Path, ) -> Result<Self, WorkspaceError>
Creates a new isolated workspace for the given task.
The workspace is created at:
{base_dir}/ralph-bench-{task_name}-{timestamp}/
§Arguments
task- The task definition to create a workspace forbase_dir- Base directory for workspaces (e.g.,/tmp)
§Errors
Returns WorkspaceError if directory creation or git init fails.
Sourcepub fn created_at(&self) -> u64
pub fn created_at(&self) -> u64
Returns the creation timestamp.
Sourcepub fn setup(
&self,
task: &TaskDefinition,
tasks_dir: &Path,
) -> Result<(), WorkspaceError>
pub fn setup( &self, task: &TaskDefinition, tasks_dir: &Path, ) -> Result<(), WorkspaceError>
Sets up the workspace with files from the task definition.
This copies:
- The prompt file as
PROMPT.md - Any setup files specified in the task definition
§Arguments
task- The task definition containing setup configurationtasks_dir- Base directory where task files are located
§Errors
Returns WorkspaceError if file copying fails.
Sourcepub fn cleanup(&mut self) -> Result<(), WorkspaceError>
pub fn cleanup(&mut self) -> Result<(), WorkspaceError>
Sourcepub fn is_cleaned_up(&self) -> bool
pub fn is_cleaned_up(&self) -> bool
Returns true if the workspace has been cleaned up.
Source§impl TaskWorkspace
impl TaskWorkspace
Sourcepub fn run_verification(
&self,
verification: &Verification,
) -> Result<VerificationResult, WorkspaceError>
pub fn run_verification( &self, verification: &Verification, ) -> Result<VerificationResult, WorkspaceError>
Runs a verification command in the workspace directory.
The command is executed via bash -c in the workspace’s root directory.
§Arguments
verification- The verification configuration with command and expected exit code
§Returns
A VerificationResult indicating whether the command passed and capturing output.
§Errors
Returns WorkspaceError::Verification if the command fails to execute
(not the same as the command returning a non-zero exit code).
Trait Implementations§
Source§impl Debug for TaskWorkspace
impl Debug for TaskWorkspace
Auto Trait Implementations§
impl Freeze for TaskWorkspace
impl RefUnwindSafe for TaskWorkspace
impl Send for TaskWorkspace
impl Sync for TaskWorkspace
impl Unpin for TaskWorkspace
impl UnwindSafe for TaskWorkspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Erasable for T
impl<T> Erasable for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more