Skip to content

Commit

Permalink
Automated cherry pick of kubeflow#2105: Support Python 3.11 and Drop …
Browse files Browse the repository at this point in the history
…Python 3.7

kubeflow#2122: Fix Incorrect Events in get_job_logs API (kubeflow#2138)

* Support Python 3.11 and Drop Python 3.7

Signed-off-by: Yuki Iwai <[email protected]>

* Fix Incorrect Events in get_job_logs API

Signed-off-by: Andrey Velichkevich <[email protected]>

---------

Signed-off-by: Yuki Iwai <[email protected]>
Signed-off-by: Andrey Velichkevich <[email protected]>
Co-authored-by: Andrey Velichkevich <[email protected]>
  • Loading branch information
tenzen-y and andreyvelich authored Jun 10, 2024
1 parent 498e66e commit ce0609f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
python-version: "3.10"
- kubernetes-version: v1.27.11
gang-scheduler-name: "none"
python-version: "3.7"
python-version: "3.11"
- kubernetes-version: v1.28.7
gang-scheduler-name: "none"
python-version: "3.8"
Expand All @@ -43,13 +43,13 @@ jobs:
python-version: "3.10"
- kubernetes-version: v1.28.7
gang-scheduler-name: "scheduler-plugins"
python-version: "3.10"
python-version: "3.11"
- kubernetes-version: v1.29.2
gang-scheduler-name: "volcano"
python-version: "3.9"
python-version: "3.8"
- kubernetes-version: v1.27.11
gang-scheduler-name: "volcano"
python-version: "3.10"
python-version: "3.9"
- kubernetes-version: v1.28.7
gang-scheduler-name: "volcano"
python-version: "3.10"
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,23 @@ jobs:
name: Test
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# TODO (tenzen-y): Once we resolve this compatibility issue, we will test against all Python versions.
# REF: https://github.com/kubeflow/training-operator/issues/2096
# python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# TODO (andreyvelich): We need to replace this action with script to do
# linting and formatting for Training Operator SDK.
- name: Check Python code with Black
Expand Down
10 changes: 5 additions & 5 deletions sdk/python/kubeflow/training/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,18 +415,18 @@ def add_event_to_dict(
):
"""Add Kubernetes event to the dict with this format:
```
{"<Object Kind> <Object Name>": "<Event Timestamp> <Event Message>"}
{"<Object Kind>/<Object Name>": "<Event Timestamp> <Event Message>"}
```
"""
if (
event.involved_object.kind == object_kind
and event.involved_object.name == object_name
and event.metadata.creation_timestamp >= object_creation_timestamp
):
event_key = f"{object_kind.lower()}/{object_name}"
event_time = event.metadata.creation_timestamp.strftime("%Y-%m-%d %H:%M:%S")
event_msg = f"{event_time} {event.message}"
if object_name not in events_dict:
events_dict[f"{object_kind} {object_name}"] = [event_msg]
if event_key not in events_dict:
events_dict[event_key] = [event_msg]
else:
events_dict[f"{object_kind} {object_name}"] += [event_msg]
return events_dict
events_dict[event_key] += [event_msg]
2 changes: 1 addition & 1 deletion sdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering",
Expand Down

0 comments on commit ce0609f

Please sign in to comment.