Skip to content

Disable PDF export for s390x architecture in Jupyter Minimal images #1521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions ci/cached-builds/gen_gha_matrix_jobs.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/kfbuild odh-workbench-jupyter-tensorflow-rocm-py312-ubi9-on-pull-request

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
S390X_COMPATIBLE = {
"runtime-minimal-ubi9-python-3.11",
"runtime-minimal-ubi9-python-3.12",
"jupyter-minimal-ubi9-python-3.11",
"jupyter-minimal-ubi9-python-3.12",
# add more here
}

Expand Down
6 changes: 6 additions & 0 deletions jupyter/utils/install_pdf_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ if [[ -z "${ARCH:-}" ]]; then
exit 1
fi

# Skip PDF export installation for s390x architecture
if [[ "$(uname -m)" == "s390x" ]]; then
echo "PDF export functionality is not supported on s390x architecture. Skipping installation."
exit 0
fi

# tex live installation
echo "Installing TexLive to allow PDf export from Notebooks"
curl -fL https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz
Expand Down
11 changes: 11 additions & 0 deletions tests/containers/architecture_support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Centralized configuration for architecture-specific feature limitations."""

ARCHITECTURE_LIMITATIONS = {
"s390x": {"pdf_export": False, "pdf_export_reason": "TexLive and Pandoc dependencies not available on s390x"},
"x86_64": {"pdf_export": True, "pdf_export_reason": "Full support available"},
"aarch64": {"pdf_export": True, "pdf_export_reason": "Full support available"},
"ppc64le": {"pdf_export": True, "pdf_export_reason": "Full support available"},
}

# Architecture mapping from uname -m to common names
ARCHITECTURE_NAMES = {"x86_64": "x86_64", "aarch64": "arm64", "ppc64le": "ppc64le", "s390x": "s390x"}
31 changes: 31 additions & 0 deletions tests/containers/architecture_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Architecture detection utilities for container tests."""

import pytest

from tests.containers import docker_utils
from tests.containers.architecture_support import ARCHITECTURE_LIMITATIONS
from tests.containers.workbenches.workbench_image_test import WorkbenchContainer


@pytest.fixture(scope="function")
def container_architecture(jupyterlab_image):
"""Cache architecture detection per test function."""
container = WorkbenchContainer(image=jupyterlab_image.name, user=4321, group_add=[0])
container.start(wait_for_readiness=False)
try:
exit_code, arch_output = container.exec(["uname", "-m"])
if exit_code == 0:
return arch_output.decode().strip()
return None
finally:
docker_utils.NotebookContainer(container).stop(timeout=0)


def is_feature_supported(architecture: str, feature: str) -> bool:
"""Check if a feature is supported on the given architecture."""
return ARCHITECTURE_LIMITATIONS.get(architecture, {}).get(feature, True)


def get_architecture_limitation_reason(architecture: str, feature: str) -> str:
"""Get the reason why a feature is not supported on the given architecture."""
return ARCHITECTURE_LIMITATIONS.get(architecture, {}).get(f"{feature}_reason", "Unknown limitation")
10 changes: 9 additions & 1 deletion tests/containers/workbenches/jupyterlab/jupyterlab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import requests

from tests.containers import conftest, docker_utils
from tests.containers.architecture_utils import (
get_architecture_limitation_reason,
is_feature_supported,
)
from tests.containers.workbenches.workbench_image_test import WorkbenchContainer


Expand Down Expand Up @@ -56,7 +60,11 @@ def test_spinner_html_loaded(self, jupyterlab_image: conftest.Image) -> None:

@allure.issue("RHOAIENG-16568")
@allure.description("Check that PDF export is working correctly")
def test_pdf_export(self, jupyterlab_image: conftest.Image) -> None:
def test_pdf_export(self, jupyterlab_image: conftest.Image, container_architecture) -> None:
# Skip if PDF export is not supported on this architecture
if not is_feature_supported(container_architecture, "pdf_export"):
reason = get_architecture_limitation_reason(container_architecture, "pdf_export")
pytest.skip(f"PDF export functionality is not supported on {container_architecture} architecture: {reason}")
container = WorkbenchContainer(image=jupyterlab_image.name, user=4321, group_add=[0])
test_file_name = "test.ipybn"
test_file_content = """{
Expand Down
Loading