Skip to main content

Session

Struct Session 

Source
pub struct Session { /* private fields */ }

Implementations§

Source§

impl Session

Source

pub fn with_config(config: SessionConfig) -> Result<Self, SessionError>

Full constructor from SessionConfig.

Source

pub fn with_path_mapping(self, rules: Vec<PathMappingRule>) -> Self

Source

pub fn extend_path_mapping_rules(&mut self, additional: Vec<PathMappingRule>)

Extend the session’s path mapping rules with additional rules. Rules are re-sorted by source path length (longest first) after extending.

Source

pub fn path_mapping_rules(&self) -> &[PathMappingRule]

Get the current path mapping rules.

Source

pub fn with_profile(self, profile: ModelProfile) -> Self

Set the ModelProfile that drives which expression functions and signatures are available to this session and which redaction rules apply. Rebuilds the session’s derived function library so subsequent expression evaluation sees the new profile.

Source

pub fn get_enabled_extensions(&self) -> Vec<String>

Returns the list of enabled extensions for this session. If no profile is set, returns an empty vec.

Source

pub fn session_id(&self) -> &str

Source

pub fn state(&self) -> SessionState

Source

pub fn working_directory(&self) -> &Path

Source

pub fn files_directory(&self) -> &Path

Source

pub fn environments_entered(&self) -> &[EnvironmentIdentifier]

Source

pub fn clone_cancel_writer(&self) -> Option<File>

Clone the cancel_writer file handle, if one exists. Used by Python bindings to send cancel commands when the session is taken by a background thread.

Source

pub fn action_status(&self) -> Option<ActionStatus>

Get the current action status, if any action has been run.

Source

pub fn override_action_state(&mut self, state: ActionState)

Override the action state. Used by the pyo3 binding to convert Failed → Canceled when cancel was requested externally.

Source

pub fn redact(&self, text: &str) -> String

Redact sensitive values from output text.

Source

pub fn cancel_action( &mut self, time_limit: Option<Duration>, mark_action_failed: bool, ) -> Result<(), SessionError>

Cancel the currently running async action.

Source

pub fn cleanup(&mut self)

Clean up the session. Deletes working directory if not retained.

Source

pub async fn enter_environment( &mut self, env: &Environment, resolved_symtab: Option<&SerializedSymbolTable>, identifier: Option<&str>, os_env_vars: Option<&HashMap<String, String>>, ) -> Result<String, SessionError>

Enter an environment asynchronously (non-blocking). Returns the environment identifier on success.

Source

pub async fn enter_environment_with_output( &mut self, env: &Environment, resolved_symtab: Option<&SerializedSymbolTable>, identifier: Option<&str>, os_env_vars: Option<&HashMap<String, String>>, ) -> Result<(String, String), SessionError>

Enter an environment, returning both the identifier and the stdout from the onEnter script.

Source

pub async fn exit_environment( &mut self, identifier: &EnvironmentIdentifier, resolved_symtab: Option<&SerializedSymbolTable>, keep_session_running: bool, os_env_vars: Option<&HashMap<String, String>>, ) -> Result<String, SessionError>

Exit an environment asynchronously, identified by its environment identifier.

Environments must be exited in LIFO order (last entered, first exited). The keep_session_running parameter controls whether the session transitions to ReadyEnding after exit — if false, the session becomes ending-only.

Source

pub async fn run_task( &mut self, script: &StepScript, task_parameter_values: Option<&TaskParameterSet>, resolved_symtab: Option<&SerializedSymbolTable>, os_env_vars: Option<&HashMap<String, String>>, ) -> Result<ActionResult, SessionError>

Run a step action asynchronously.

Source

pub async fn run_subprocess( &mut self, command: &str, args: Option<&[String]>, timeout: Option<Duration>, os_env_vars: Option<&HashMap<String, String>>, use_session_env_vars: bool, log_banner_message: Option<&str>, ) -> Result<SubprocessResult, SessionError>

Run an ad-hoc subprocess within the Session.

Unlike run_task, this runs a raw command without format string evaluation, embedded file materialization, or path mapping. Used by the worker agent for install/sync operations.

Source

pub fn evaluate_env_vars( &self, extra: Option<&HashMap<String, String>>, ) -> HashMap<String, Option<String>>

Evaluate the cumulative env vars from process_env + extra + per-environment changes. Mirrors Python _evaluate_current_session_env_vars.

Source

pub fn job_parameter_values(&self) -> &JobParameterValues

Get the job parameter values.

Source

pub fn build_symbol_table( &self, task_parameter_values: Option<&TaskParameterSet>, base: Option<&SerializedSymbolTable>, ) -> Result<SymbolTable, SessionError>

Build a SymbolTable for running actions, mirroring Python’s Session._symbol_table(). Populates job parameters (Param.* and RawParam.), task parameters (Task.Param. and Task.RawParam.*), and Session.WorkingDirectory.

If base is provided, clones it as the starting point (it already contains Param., RawParam., Job.Name, Step.Name, and let bindings) and only layers Session.WorkingDirectory and Task.* on top. If base is None, builds from scratch using self.job_parameter_values.

Trait Implementations§

Source§

impl Drop for Session

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.