pub struct Session { /* private fields */ }Implementations§
Source§impl Session
impl Session
Sourcepub fn with_config(config: SessionConfig) -> Result<Self, SessionError>
pub fn with_config(config: SessionConfig) -> Result<Self, SessionError>
Full constructor from SessionConfig.
pub fn with_path_mapping(self, rules: Vec<PathMappingRule>) -> Self
Sourcepub fn extend_path_mapping_rules(&mut self, additional: Vec<PathMappingRule>)
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.
Sourcepub fn path_mapping_rules(&self) -> &[PathMappingRule]
pub fn path_mapping_rules(&self) -> &[PathMappingRule]
Get the current path mapping rules.
Sourcepub fn with_profile(self, profile: ModelProfile) -> Self
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.
Sourcepub fn get_enabled_extensions(&self) -> Vec<String>
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.
pub fn session_id(&self) -> &str
pub fn state(&self) -> SessionState
pub fn working_directory(&self) -> &Path
pub fn files_directory(&self) -> &Path
pub fn environments_entered(&self) -> &[EnvironmentIdentifier] ⓘ
Sourcepub fn clone_cancel_writer(&self) -> Option<File>
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.
Sourcepub fn action_status(&self) -> Option<ActionStatus>
pub fn action_status(&self) -> Option<ActionStatus>
Get the current action status, if any action has been run.
Sourcepub fn override_action_state(&mut self, state: ActionState)
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.
Sourcepub fn cancel_action(
&mut self,
time_limit: Option<Duration>,
mark_action_failed: bool,
) -> Result<(), SessionError>
pub fn cancel_action( &mut self, time_limit: Option<Duration>, mark_action_failed: bool, ) -> Result<(), SessionError>
Cancel the currently running async action.
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub fn evaluate_env_vars(
&self,
extra: Option<&HashMap<String, String>>,
) -> HashMap<String, Option<String>>
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.
Sourcepub fn job_parameter_values(&self) -> &JobParameterValues
pub fn job_parameter_values(&self) -> &JobParameterValues
Get the job parameter values.
Sourcepub fn build_symbol_table(
&self,
task_parameter_values: Option<&TaskParameterSet>,
base: Option<&SerializedSymbolTable>,
) -> Result<SymbolTable, SessionError>
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§
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl !UnwindSafe for Session
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> 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