Skip to content

Commit

Permalink
include error
Browse files Browse the repository at this point in the history
  • Loading branch information
spicy-sauce committed Aug 5, 2024
1 parent e317cab commit a6860cc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions integration-tests/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ def wait_program(process: Popen, sig: Optional[int] = signal.SIGTERM, ignore_err

process.communicate()

if not ignore_errors:
if process.returncode != 0:
raise ValueError("command failed")
if not ignore_errors and process.returncode != 0:
_, stderr = process.communicate()
error_message = stderr if stderr else "Unknown error"
raise ValueError(f"Command failed with return code {process.returncode}: {error_message}")


def run_job(
Expand All @@ -78,7 +79,7 @@ def run_job(
piped_to_cmd = f" > {piped_to}" if piped_to else ""

command = f'{piped_from_cmd}datayoga run {job_name} ' \
f'--dir {path.join(path.dirname(path.realpath(__file__)), "..", "resources")} ' \
f'--loglevel DEBUG{piped_to_cmd}'
f'--dir {path.join(path.dirname(path.realpath(__file__)), "..", "resources")} ' \
f'--loglevel DEBUG{piped_to_cmd}'

return execute_program(command, background=background)

0 comments on commit a6860cc

Please sign in to comment.