Skip to content

Commit

Permalink
Merge pull request #28976 from loganharbour/28975_sep_files_output
Browse files Browse the repository at this point in the history
Limit runner_run output instead of skipping it when using --sep-files
  • Loading branch information
loganharbour authored Oct 31, 2024
2 parents e1a4810 + 823e7c1 commit c80f515
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions python/TestHarness/schedulers/Job.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,11 @@ def getOutputForScreen(self):

output = 'Working Directory: ' + self.getTestDir() + '\nRunning command: ' + command + '\n'

# Whether or not to skip the runner_run output, which is the output from the
# Whether or not to limit the runner_run output, which is the output from the
# actual run (the process that the harness runs)
skip_runner_run = None
limit_runner_run = None
if self.options.sep_files and not self.options.verbose:
skip_runner_run = '--sep-files'
limit_runner_run = '-x/--sep-files'

options = self.options
specs = self.specs
Expand All @@ -575,11 +575,13 @@ def getOutputForScreen(self):

# Possibly trim or skip the runner_run output (actual process output)
if name == 'runner_run':
# Don't output the runner run
if skip_runner_run:
output += f'\nSkipping runner_run output due to {skip_runner_run}; output located at:\n'
output += object.getSeparateOutputFilePath() + '\n'
continue
# Limit the runner run output
if limit_runner_run:
output_split = object_output.splitlines()
max_lines = 100
if len(output_split) > max_lines:
prefix = f'Displaying last {max_lines} lines due to {limit_runner_run}\n\n'
object_output = prefix + '\n'.join(output_split[-max_lines:])

# Default trimmed output size
max_size = 100000
Expand All @@ -603,11 +605,12 @@ def getOutputForScreen(self):
output += '\n'
# Add a header before the output starts
output += util.outputHeader(f'Begin {name} output', ending=False) + '\n'
# Remove extra line breaks
object_output = object_output.lstrip().rstrip()
# Add the output, trimming if needed
output += util.trimOutput(object_output, max_size=max_size)
# Add a newline if one is missing
if output[-1] != '\n':
output += '\n'
output += util.trimOutput(object_output.lstrip().rstrip(), max_size=max_size)
# Add a newline as we ran rstrip
output += '\n'
# Add a footer after the output ends
output += '\n' + util.outputHeader(f'End {name} output', ending=False)

Expand Down

0 comments on commit c80f515

Please sign in to comment.