From 7e9ab19ec59487948364d25ae739e683b9eebea7 Mon Sep 17 00:00:00 2001 From: ChristianZaccaria Date: Wed, 31 Jul 2024 13:52:06 +0100 Subject: [PATCH 1/2] Add optimised dependabot --- .github/dependabot.yml | 29 +++++++++++++++++++++++++++++ tests/unit_test.py | 9 +++++++-- tests/unit_test_support.py | 8 ++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..fb121a712 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,29 @@ +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + # This is to update requirements.txt files in the guided-demos, and e2e directories. + # The group configuration option is used to group updates for consistency across related directories. + - package-ecosystem: "pip" + directories: + - "**/demo-notebooks/guided-demos*" + - "/tests/e2e" + schedule: + interval: "weekly" + groups: + requirements.txt: + patterns: + - "*" + open-pull-requests-limit: 10 + labels: + - "test-guided-notebooks" + + # pip means poetry in this case, this keeps poetry.lock up to date with constraints in pyproject.toml. + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + labels: + - "test-guided-notebooks" diff --git a/tests/unit_test.py b/tests/unit_test.py index 2709894ec..ba937d873 100644 --- a/tests/unit_test.py +++ b/tests/unit_test.py @@ -68,6 +68,7 @@ createClusterWithConfig, createClusterConfig, createClusterWrongType, + get_package_and_version, ) import codeflare_sdk.utils.kube_api_helpers @@ -2832,9 +2833,13 @@ def test_rjc_tail_job_logs(ray_job_client, mocker): def test_rjc_list_jobs(ray_job_client, mocker): + requirements_path = "tests/e2e/mnist_pip_requirements.txt" + pytorch_lightning = get_package_and_version("pytorch_lightning", requirements_path) + torchmetrics = get_package_and_version("torchmetrics", requirements_path) + torchvision = get_package_and_version("torchvision", requirements_path) jobs_list = [ - "JobDetails(type=, job_id=None, submission_id='raysubmit_4k2NYS1YbRXYPZCM', driver_info=None, status=, entrypoint='python mnist.py', message='Job finished successfully.', error_type=None, start_time=1701352132585, end_time=1701352192002, metadata={}, runtime_env={'working_dir': 'gcs://_ray_pkg_6200b93a110e8033.zip', 'pip': {'packages': ['pytorch_lightning==1.9.5', 'ray_lightning', 'torchmetrics==0.9.1', 'torchvision==0.12.0'], 'pip_check': False}, '_ray_commit': 'b4bba4717f5ba04ee25580fe8f88eed63ef0c5dc'}, driver_agent_http_address='http://10.131.0.18:52365', driver_node_id='9fb515995f5fb13ad4db239ceea378333bebf0a2d45b6aa09d02e691')", - "JobDetails(type=, job_id=None, submission_id='raysubmit_iRuwU8vdkbUZZGvT', driver_info=None, status=, entrypoint='python mnist.py', message='Job was intentionally stopped.', error_type=None, start_time=1701353096163, end_time=1701353097733, metadata={}, runtime_env={'working_dir': 'gcs://_ray_pkg_6200b93a110e8033.zip', 'pip': {'packages': ['pytorch_lightning==1.9.5', 'ray_lightning', 'torchmetrics==0.9.1', 'torchvision==0.12.0'], 'pip_check': False}, '_ray_commit': 'b4bba4717f5ba04ee25580fe8f88eed63ef0c5dc'}, driver_agent_http_address='http://10.131.0.18:52365', driver_node_id='9fb515995f5fb13ad4db239ceea378333bebf0a2d45b6aa09d02e691')", + f"JobDetails(type=, job_id=None, submission_id='raysubmit_4k2NYS1YbRXYPZCM', driver_info=None, status=, entrypoint='python mnist.py', message='Job finished successfully.', error_type=None, start_time=1701352132585, end_time=1701352192002, metadata={{}}, runtime_env={{'working_dir': 'gcs://_ray_pkg_6200b93a110e8033.zip', 'pip': {{'packages': ['{pytorch_lightning}', 'ray_lightning', '{torchmetrics}', '{torchvision}'], 'pip_check': False}}, '_ray_commit': 'b4bba4717f5ba04ee25580fe8f88eed63ef0c5dc'}}, driver_agent_http_address='http://10.131.0.18:52365', driver_node_id='9fb515995f5fb13ad4db239ceea378333bebf0a2d45b6aa09d02e691')", + f"JobDetails(type=, job_id=None, submission_id='raysubmit_iRuwU8vdkbUZZGvT', driver_info=None, status=, entrypoint='python mnist.py', message='Job was intentionally stopped.', error_type=None, start_time=1701353096163, end_time=1701353097733, metadata={{}}, runtime_env={{'working_dir': 'gcs://_ray_pkg_6200b93a110e8033.zip', 'pip': {{'packages': ['{pytorch_lightning}', 'ray_lightning', '{torchmetrics}', '{torchvision}'], 'pip_check': False}}, '_ray_commit': 'b4bba4717f5ba04ee25580fe8f88eed63ef0c5dc'}}, driver_agent_http_address='http://10.131.0.18:52365', driver_node_id='9fb515995f5fb13ad4db239ceea378333bebf0a2d45b6aa09d02e691')", ] mocked_rjc_list_jobs = mocker.patch.object( JobSubmissionClient, "list_jobs", return_value=jobs_list diff --git a/tests/unit_test_support.py b/tests/unit_test_support.py index 9fcdd5a5e..dd8c2fceb 100644 --- a/tests/unit_test_support.py +++ b/tests/unit_test_support.py @@ -50,3 +50,11 @@ def createClusterWrongType(): labels={1: 1}, ) return config + + +def get_package_and_version(package_name, requirements_file_path): + with open(requirements_file_path, "r") as file: + for line in file: + if line.strip().startswith(f"{package_name}=="): + return line.strip() + return None From 2701b50b6ec865dd9476e3a7790347ed9a59b8a1 Mon Sep 17 00:00:00 2001 From: ChristianZaccaria Date: Thu, 1 Aug 2024 11:37:15 +0100 Subject: [PATCH 2/2] Change custom-nb-image/requirements.txt path to exclude from dependency bumps --- custom-nb-image/Dockerfile | 2 +- custom-nb-image/{ => requirements}/requirements.txt | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename custom-nb-image/{ => requirements}/requirements.txt (100%) diff --git a/custom-nb-image/Dockerfile b/custom-nb-image/Dockerfile index a656618e4..fca83e25f 100644 --- a/custom-nb-image/Dockerfile +++ b/custom-nb-image/Dockerfile @@ -14,7 +14,7 @@ FROM quay.io/opendatahub/notebooks:jupyter-minimal-ubi9-python-3.9-2023a_20230302 -COPY requirements.txt requirements.txt +COPY requirements/requirements.txt requirements.txt RUN pip install -r requirements.txt diff --git a/custom-nb-image/requirements.txt b/custom-nb-image/requirements/requirements.txt similarity index 100% rename from custom-nb-image/requirements.txt rename to custom-nb-image/requirements/requirements.txt