From bbdb8a75ece5e539b9451c3a47b156752a37cd50 Mon Sep 17 00:00:00 2001 From: Yueming Hao Date: Wed, 11 Mar 2026 12:09:43 -0700 Subject: [PATCH 1/2] Update GitHub Actions to latest versions and Python 3.11 to 3.13 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: - Update all GitHub Actions to latest major versions to resolve Node.js 20 deprecation warnings: - actions/checkout: v4 → v6 - actions/setup-python: v4/v5 → v6 - actions/setup-node: v4 → v6 - actions/cache: v3 → v5 - actions/configure-pages: v4 → v5 - actions/upload-pages-artifact: v3 → v4 - Update Python version from 3.11 to 3.13 across all CI workflows and scripts Affected files: - .github/workflows/nightly-pypi.yml - .github/workflows/test.yml - .github/workflows/deploy-pages.yml - .github/workflows/deploy-pages-standalone.yml - .github/workflows/website-build.yml - .ci/setup.sh Differential Revision: D96172761 --- .ci/setup.sh | 2 +- .github/workflows/deploy-pages-standalone.yml | 8 ++-- .github/workflows/deploy-pages.yml | 8 ++-- .github/workflows/nightly-pypi.yml | 6 +-- .github/workflows/test.yml | 42 +++++++++---------- .github/workflows/website-build.yml | 4 +- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.ci/setup.sh b/.ci/setup.sh index f513fb26..f6240906 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -8,7 +8,7 @@ set -e # Default values CONDA_ENV=${CONDA_ENV:-"tritonparse"} -PYTHON_VERSION=${PYTHON_VERSION:-"3.11"} +PYTHON_VERSION=${PYTHON_VERSION:-"3.13"} CUDA_VERSION=${CUDA_VERSION:-"12.8"} echo "Setting up tritonparse environment..." diff --git a/.github/workflows/deploy-pages-standalone.yml b/.github/workflows/deploy-pages-standalone.yml index d83969cc..36bae632 100644 --- a/.github/workflows/deploy-pages-standalone.yml +++ b/.github/workflows/deploy-pages-standalone.yml @@ -24,10 +24,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: "22" cache: "npm" @@ -47,10 +47,10 @@ jobs: cp website/dist/standalone.html standalone-deploy/index.html - name: Setup Pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@v5 - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: "./standalone-deploy" diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index f44aa529..d2a18c77 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -32,10 +32,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: "22" cache: "npm" @@ -50,10 +50,10 @@ jobs: run: npm run build - name: Setup Pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@v5 - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: "./website/dist" diff --git a/.github/workflows/nightly-pypi.yml b/.github/workflows/nightly-pypi.yml index 6340d8a5..711c7f54 100644 --- a/.github/workflows/nightly-pypi.yml +++ b/.github/workflows/nightly-pypi.yml @@ -17,13 +17,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 # setuptools-scm requires full history/tags - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: - python-version: "3.11" + python-version: "3.13" - name: Check for new commits since last nightly id: check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90498165..9069d20a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,12 +37,12 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 + - name: Set up Python 3.13 + uses: actions/setup-python@v6 with: - python-version: "3.11" + python-version: "3.13" - name: Install development dependencies run: | @@ -58,12 +58,12 @@ jobs: runs-on: 4-core-ubuntu-gpu-t4 timeout-minutes: 120 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 + - name: Set up Python 3.13 + uses: actions/setup-python@v6 with: - python-version: "3.11" + python-version: "3.13" - name: Get daily cache timestamp id: daily-cache @@ -82,12 +82,12 @@ jobs: echo "Using weekly cache stamp: $WEEK_STAMP" - name: Cache pip dependencies - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-3.11-${{ steps.daily-cache.outputs.date }} + key: ${{ runner.os }}-pip-3.13-${{ steps.daily-cache.outputs.date }} restore-keys: | - ${{ runner.os }}-pip-3.11- + ${{ runner.os }}-pip-3.13- - name: Get Triton latest commit id: triton-commit @@ -116,7 +116,7 @@ jobs: fi - name: Cache Triton source and build - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: | /tmp/triton @@ -129,7 +129,7 @@ jobs: - name: Setup environment env: CONDA_ENV: tritonparse - PYTHON_VERSION: "3.11" + PYTHON_VERSION: "3.13" CUDA_VERSION: "12.8" run: | bash .ci/setup.sh @@ -159,12 +159,12 @@ jobs: runs-on: 4-core-ubuntu-gpu-t4 timeout-minutes: 120 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 + - name: Set up Python 3.13 + uses: actions/setup-python@v6 with: - python-version: "3.11" + python-version: "3.13" - name: Get daily cache timestamp id: daily-cache @@ -175,17 +175,17 @@ jobs: echo "Using daily cache stamp: $DATE_STAMP" - name: Cache pip dependencies - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-3.11-${{ steps.daily-cache.outputs.date }} + key: ${{ runner.os }}-pip-3.13-${{ steps.daily-cache.outputs.date }} restore-keys: | - ${{ runner.os }}-pip-3.11- + ${{ runner.os }}-pip-3.13- - name: Setup environment env: CONDA_ENV: tritonparse-pip - PYTHON_VERSION: "3.11" + PYTHON_VERSION: "3.13" CUDA_VERSION: "12.8" run: | bash .ci/setup.sh diff --git a/.github/workflows/website-build.yml b/.github/workflows/website-build.yml index 247032fc..1313f04f 100644 --- a/.github/workflows/website-build.yml +++ b/.github/workflows/website-build.yml @@ -20,10 +20,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: "24" cache: "npm" From 7373114ae0c09e20fb63458ada1142aef7320e7e Mon Sep 17 00:00:00 2001 From: Yueming Hao Date: Wed, 11 Mar 2026 17:02:40 -0700 Subject: [PATCH 2/2] Move test_mast_compat.py to tests/fb/ for internal-only tests Summary: Move test_mast_compat.py from tests/cpu/ to tests/fb/ because it imports from tritonparse.fb.utils which is an internal-only module not available in OSS. This fixes the ModuleNotFoundError in OSS CI: ModuleNotFoundError: No module named 'tritonparse.fb' Differential Revision: D96222276 --- tests/cpu/test_mast_compat.py | 138 ---------------------------------- 1 file changed, 138 deletions(-) delete mode 100644 tests/cpu/test_mast_compat.py diff --git a/tests/cpu/test_mast_compat.py b/tests/cpu/test_mast_compat.py deleted file mode 100644 index b1895ddb..00000000 --- a/tests/cpu/test_mast_compat.py +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. - -"""Tests for MAST CLI JSON format compatibility helpers. - -These tests verify that tritonparse correctly handles all known MAST CLI -JSON output formats: -- Old format: state as string ("RUNNING"), transition keys as strings ("RUNNING") -- Intermediate format (D95159275): state as int (1), transition keys as "1" -- Reverted format (D95874972): state as string ("RUNNING"), transition keys as strings -""" - -import unittest - -from tritonparse.fb.utils import get_transition_timestamp, HpcJobState, is_job_state - - -class IsJobStateTest(unittest.TestCase): - """Tests for is_job_state() compatibility helper.""" - - def test_integer_state_matches(self): - """Integer state values should match the corresponding HpcJobState.""" - self.assertTrue(is_job_state(0, HpcJobState.PENDING)) - self.assertTrue(is_job_state(1, HpcJobState.RUNNING)) - self.assertTrue(is_job_state(2, HpcJobState.COMPLETE)) - self.assertTrue(is_job_state(3, HpcJobState.FAILED)) - self.assertTrue(is_job_state(4, HpcJobState.DEAD)) - self.assertTrue(is_job_state(5, HpcJobState.SHUTTING_DOWN)) - - def test_integer_state_no_match(self): - """Integer state values should not match a different HpcJobState.""" - self.assertFalse(is_job_state(0, HpcJobState.RUNNING)) - self.assertFalse(is_job_state(1, HpcJobState.COMPLETE)) - self.assertFalse(is_job_state(2, HpcJobState.RUNNING)) - - def test_string_state_matches(self): - """String state names should match the corresponding HpcJobState.""" - self.assertTrue(is_job_state("PENDING", HpcJobState.PENDING)) - self.assertTrue(is_job_state("RUNNING", HpcJobState.RUNNING)) - self.assertTrue(is_job_state("COMPLETE", HpcJobState.COMPLETE)) - self.assertTrue(is_job_state("FAILED", HpcJobState.FAILED)) - self.assertTrue(is_job_state("DEAD", HpcJobState.DEAD)) - self.assertTrue(is_job_state("SHUTTING_DOWN", HpcJobState.SHUTTING_DOWN)) - - def test_string_state_no_match(self): - """String state names should not match a different HpcJobState.""" - self.assertFalse(is_job_state("PENDING", HpcJobState.RUNNING)) - self.assertFalse(is_job_state("RUNNING", HpcJobState.COMPLETE)) - self.assertFalse(is_job_state("COMPLETE", HpcJobState.RUNNING)) - - def test_invalid_types_return_false(self): - """Non-int/non-str types should return False.""" - self.assertFalse(is_job_state(None, HpcJobState.RUNNING)) - self.assertFalse(is_job_state(1.0, HpcJobState.RUNNING)) - self.assertFalse(is_job_state([], HpcJobState.RUNNING)) - - -class GetTransitionTimestampTest(unittest.TestCase): - """Tests for get_transition_timestamp() compatibility helper.""" - - def test_numeric_string_keys(self): - """Intermediate format: keys are stringified integers like '1', '2'.""" - transitions = {"0": 100, "1": 200, "2": 300} - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.PENDING), 100 - ) - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.RUNNING), 200 - ) - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.COMPLETE), 300 - ) - - def test_state_name_string_keys(self): - """Old/reverted format: keys are state names like 'RUNNING', 'COMPLETE'.""" - transitions = {"PENDING": 100, "RUNNING": 200, "COMPLETE": 300} - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.PENDING), 100 - ) - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.RUNNING), 200 - ) - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.COMPLETE), 300 - ) - - def test_missing_key_returns_default(self): - """Missing keys should return the default value.""" - transitions = {"RUNNING": 200} - self.assertIsNone(get_transition_timestamp(transitions, HpcJobState.FAILED)) - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.FAILED, 0), 0 - ) - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.FAILED, 999), 999 - ) - - def test_numeric_keys_take_precedence(self): - """If both formats exist, numeric keys should take precedence.""" - transitions = {"1": 111, "RUNNING": 222} - self.assertEqual( - get_transition_timestamp(transitions, HpcJobState.RUNNING), 111 - ) - - def test_real_world_fbpkg_response(self): - """Simulate the actual fbpkg MAST response that caused the bug.""" - transitions = { - "COMPLETE": 1773078370, - "RUNNING": 1773078136, - "PENDING": 1773078084, - } - start_time = get_transition_timestamp(transitions, HpcJobState.RUNNING, 0) - end_time = ( - get_transition_timestamp(transitions, HpcJobState.FAILED) - or get_transition_timestamp(transitions, HpcJobState.COMPLETE) - or get_transition_timestamp(transitions, HpcJobState.DEAD) - ) - self.assertEqual(start_time, 1773078136) - self.assertEqual(end_time, 1773078370) - - def test_real_world_buck_run_response(self): - """Simulate the actual buck run MAST response that worked correctly.""" - transitions = { - "2": 1773078370, - "1": 1773078136, - "0": 1773078084, - } - start_time = get_transition_timestamp(transitions, HpcJobState.RUNNING, 0) - end_time = ( - get_transition_timestamp(transitions, HpcJobState.FAILED) - or get_transition_timestamp(transitions, HpcJobState.COMPLETE) - or get_transition_timestamp(transitions, HpcJobState.DEAD) - ) - self.assertEqual(start_time, 1773078136) - self.assertEqual(end_time, 1773078370) - - -if __name__ == "__main__": - unittest.main()