Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions tests/integration-tests/tests/common/schedulers_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from retrying import retry
from time_utils import minutes, seconds

from tests.common.utils import is_blank


class SchedulerCommands(metaclass=ABCMeta):
"""Define common scheduler commands."""
Expand Down Expand Up @@ -398,17 +400,24 @@ def _dump_job_output(self, job_info):
if match_stdout:
stdout = match_stdout.group(1)
logging.info("stdout:" + stdout)
if stderr is not None or stdout is not None:
if stderr == stdout:
result = self._remote_command_executor.run_remote_command(f'echo "stderr/stdout:" && cat {stderr}')
dump_timeout = 60
if not is_blank(stderr) or not is_blank(stdout):
if not is_blank(stderr) and stderr == stdout:
result = self._remote_command_executor.run_remote_command(
f'echo "stderr/stdout:" && cat {stderr}', timeout=dump_timeout
)
logging.error(result.stdout)
else:
if stderr is not None:
stderr_result = self._remote_command_executor.run_remote_command(f'echo "stderr" && cat {stderr}')
if not is_blank(stderr):
stderr_result = self._remote_command_executor.run_remote_command(
f'echo "stderr" && cat {stderr}', timeout=dump_timeout
)
logging.error(stderr_result.stdout)

if stdout is not None:
stdout_result = self._remote_command_executor.run_remote_command(f'echo "stdout" && cat {stdout}')
if not is_blank(stdout):
stdout_result = self._remote_command_executor.run_remote_command(
f'echo "stdout" && cat {stdout}', timeout=dump_timeout
)
logging.error(stdout_result.stdout)
else:
logging.error("Unable to retrieve job output.")
Expand Down
5 changes: 5 additions & 0 deletions tests/integration-tests/tests/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ def get_sts_endpoint(region):
return "https://sts.{0}.{1}".format(region, get_aws_domain(region))


def is_blank(value):
"""Return True if the value is None or an empty/whitespace-only string."""
return value is None or value.strip() == ""


def generate_random_string():
"""
Generate a random prefix that is 16 characters long.
Expand Down
Loading