Skip to content

Commit d0e1a1d

Browse files
authored
Fixed how standard output argument and redirection is handled. (#42)
1 parent e4b5ccc commit d0e1a1d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

hpc_launcher/cli/console_pipe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def _run_process(
5555
# Create the subprocess
5656
args = [] if len(command) == 1 else command[1:]
5757
process = await asyncio.create_subprocess_exec(
58-
command[0], *args, stdout=subprocess.PIPE, stderr=subprocess.PIPE
58+
command[0], *args, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
5959
)
6060

6161
# Read the stdout and stderr concurrently

hpc_launcher/schedulers/scheduler.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,18 @@ def create_launch_folder(
481481
if self.out_log_file is None:
482482
self.out_log_file = os.path.abspath(os.path.join(folder_name, "out.log"))
483483
should_make_folder = True
484+
else:
485+
if not os.path.isabs(self.out_log_file):
486+
log_file = os.path.abspath(os.path.join(folder_name, self.out_log_file))
487+
self.out_log_file = log_file
488+
484489
if self.err_log_file is None:
485490
self.err_log_file = os.path.abspath(os.path.join(folder_name, "err.log"))
486491
should_make_folder = True
492+
else:
493+
if not os.path.isabs(self.err_log_file):
494+
log_file = os.path.abspath(os.path.join(folder_name, self.err_log_file))
495+
self.err_log_file = log_file
487496

488497
stub_file = ""
489498
if should_make_folder:
@@ -560,8 +569,8 @@ def launch(
560569
logger.info(f'Launching {" ".join(full_cmdline)}')
561570

562571
if blocking: # Launch job and trace outputs live
563-
with open(os.path.join(folder_name, "out.log"), "wb") as out_file:
564-
with open(os.path.join(folder_name, "err.log"), "wb") as err_file:
572+
with open(self.out_log_file, "wb") as out_file:
573+
with open(self.err_log_file, "wb") as err_file:
565574

566575
run_process_with_live_output(
567576
full_cmdline,

0 commit comments

Comments
 (0)