Skip to content

Commit 3f66115

Browse files
committed
remove use_session_env_vars, only support without session env
Signed-off-by: Godot Bian <13778003+godobyte@users.noreply.github.com>
1 parent 12a0b5f commit 3f66115

2 files changed

Lines changed: 73 additions & 220 deletions

File tree

src/openjd/sessions/_session.py

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -843,35 +843,16 @@ def run_task(
843843
# than after -- run() itself may end up setting the action state to FAILED.
844844
self._runner.run()
845845

846-
def _run_task_with_optional_session_env(
846+
def _run_task_without_session_env(
847847
self,
848848
*,
849849
step_script: StepScriptModel,
850850
task_parameter_values: TaskParameterSet,
851851
os_env_vars: Optional[dict[str, str]] = None,
852-
use_session_env_vars: Optional[bool] = True,
853852
log_task_banner: bool = True,
854853
) -> None:
855-
"""Run a Task within the Session.
856-
This method is non-blocking; it will exit when the subprocess is either confirmed to have
857-
started running, or has failed to be started.
858-
859-
Arguments:
860-
step_script (StepScriptModel): The Step Script that the Task will be running.
861-
task_parameter_values (TaskParameterSet): Values of the Task parameters that define the
862-
specific Task. This is a dictionary where the keys are parameter names, and the values
863-
are instances of ParameterValue (a dataclass containing the type and value of the parameter)
864-
os_env_vars (Optional[dict[str,str]): Definitions for additional OS Environment
865-
Variables that should be injected into the process that is run for this action.
866-
Values provided override values provided to the Session constructor, and are overriden
867-
by values defined in Environments.
868-
Key: Environment variable name
869-
Value: Value for the environment variable.
870-
use_session_env_vars (Optional[bool]): Whether to apply environment variable changes from
871-
entered environments. When True (default), applies changes from all entered environments
872-
in order. When False, only uses base session and os_env_vars.
873-
log_task_banner (bool): Whether to log a banner before running the Task.
874-
Default: True
854+
"""Private API to run a task within the session.
855+
This method directly use os_env_vars passed in without applying additional session env setup.
875856
"""
876857
if self.state != SessionState.READY:
877858
raise RuntimeError("Session must be in the READY state to run a task.")
@@ -894,12 +875,9 @@ def _run_task_with_optional_session_env(
894875
symtab = self._symbol_table(step_script.revision, task_parameter_values)
895876

896877
# Evaluate environment variables
897-
if use_session_env_vars:
898-
action_env_vars = self._evaluate_current_session_env_vars(os_env_vars)
899-
else:
900-
action_env_vars = dict[str, Optional[str]](self._process_env) # Make a copy
901-
if os_env_vars:
902-
action_env_vars.update(**os_env_vars)
878+
action_env_vars = dict[str, Optional[str]](self._process_env) # Make a copy
879+
if os_env_vars:
880+
action_env_vars.update(**os_env_vars)
903881

904882
self._materialize_path_mapping(step_script.revision, action_env_vars, symtab)
905883
self._runner = StepScriptRunner(

0 commit comments

Comments
 (0)