Skip to content

Commit

Permalink
Launch env scripts in shell (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuds13 authored Aug 6, 2024
1 parent 0c6df92 commit fd555b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libensemble/executors/mpi_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def set_resources(self, resources: Resources) -> None:
self.resources = resources

def _launch_with_retries(
self, task: Task, subgroup_launch: bool, wait_on_start: Union[bool, int], run_cmd: List[str]
self, task: Task, subgroup_launch: bool, wait_on_start: Union[bool, int], run_cmd: List[str], use_shell: bool
) -> None:
"""Launch task with retry mechanism"""
retry_count = 0
Expand All @@ -156,6 +156,7 @@ def _launch_with_retries(
stdout=out,
stderr=err,
start_new_session=subgroup_launch,
shell=use_shell,
)
except Exception as e:
logger.warning(f"task {task.name} submit command failed on try {retry_count} with error {e}")
Expand Down Expand Up @@ -367,8 +368,10 @@ def submit(

if env_script is not None:
run_cmd = Executor._process_env_script(task, runline, env_script)
use_shell = True
else:
run_cmd = runline
use_shell = False

if dry_run:
logger.info(f"Test (No submit) Runline: {' '.join(run_cmd)}")
Expand All @@ -378,7 +381,7 @@ def submit(
task._implement_env()

# Launch Task
self._launch_with_retries(task, sglaunch, wait_on_start, run_cmd)
self._launch_with_retries(task, sglaunch, wait_on_start, run_cmd, use_shell)

if not task.timer.timing and not task.finished:
task.timer.start()
Expand Down

0 comments on commit fd555b8

Please sign in to comment.