diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 7ee36c49..bb54b9ec 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -2,17 +2,62 @@ name: Development on: pull_request: - branches: - - '**' + types: [opened, synchronize, reopened] jobs: + quality-checks: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run quality checks + run: tox -e quality + + type-checks: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run quality checks + run: tox -e types + + precommit-checks: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install pre-commit + - name: Run pre-commit checks + run: pre-commit run --all-files + unit-tests: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.13" - - "3.9" + python: ["3.9", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -28,9 +73,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.13" - - "3.9" + python: ["3.9", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -41,3 +84,38 @@ jobs: run: pip install tox - name: Run integration tests run: tox -e test-integration -- -m smoke + + build: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install toml loguru tox + - name: Set environment variables + run: | + echo "GUIDELLM_BUILD_TYPE=dev" >> $GITHUB_ENV + echo "GUIDELLM_BUILD_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV + - name: Build the package + run: tox -e build + - name: Upload build artifacts + id: artifact-upload + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + path: dist/* + compression-level: 6 + if-no-files-found: error + retention-days: 30 + - name: Comment Install instructions + uses: mshick/add-pr-comment@v2 + with: + message: | + Build artifacts (.whl and .tar.gz) are available for download for up to 30 days. + They are located at ${{ steps.artifact-upload.outputs.artifact-url }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..6c2e4988 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,87 @@ +name: Main + +on: + push: + branches: + - main + +jobs: + quality-checks: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run quality checks + run: tox -e quality + + type-checks: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run quality checks + run: tox -e types + + precommit-checks: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install pre-commit + - name: Run pre-commit checks + run: pre-commit run --all-files + + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run unit tests + run: tox -e test-unit -- -m "smoke or sanity" + + integration-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run integration tests + run: tox -e test-integration -- -m smoke diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 634ab52c..97a61d11 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -9,12 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.13" - - "3.12" - - "3.11" - - "3.10" - - "3.9" + python: ["3.9", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -24,18 +19,13 @@ jobs: - name: Install dependencies run: pip install tox - name: Run unit tests - run: tox -e test-unit -- --cov-report=term-missing --cov --cov-fail-under=75 + run: tox -e test-unit -- -m --cov=guidellm --cov-report=term-missing --cov-fail-under=75 integration-tests: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.13" - - "3.12" - - "3.11" - - "3.10" - - "3.9" + python: ["3.9", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -51,12 +41,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.13" - - "3.12" - - "3.11" - - "3.10" - - "3.9" + python: ["3.9", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -65,5 +50,58 @@ jobs: python-version: ${{ matrix.python }} - name: Install dependencies run: pip install tox - - name: Run e2e tests + - name: Run integration tests run: tox -e test-e2e -- -m smoke + + build-and-publish: + needs: [unit-tests, integration-tests, e2e-tests] + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install toml loguru tox + - name: Set environment variables + run: | + echo "GUIDELLM_BUILD_TYPE=nightly" >> $GITHUB_ENV + echo "GUIDELLM_BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV + - name: Build the package + run: tox -e build + - name: Find wheel artifact + id: find-asset-whl + run: | + echo "::set-output name=asset::$(find dist -name '*.whl')" + - name: Find tar.gz artifact + id: find-asset-targz + run: | + echo "::set-output name=asset::$(find dist -name '*.tar.gz')" + - name: Push wheel to PyPI + uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0 + with: + username: ${{ secrets.PYPI_PUBLIC_USER }} + password: ${{ secrets.PYPI_PUBLIC_AUTH }} + whl: ${{ steps.find-asset-whl.outputs.asset }} + - name: Push tar.gz to PyPI + uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0 + with: + username: ${{ secrets.PYPI_PUBLIC_USER }} + password: ${{ secrets.PYPI_PUBLIC_AUTH }} + whl: ${{ steps.find-asset-targz.outputs.asset }} + - name: Upload build artifacts + id: artifact-upload + uses: actions/upload-artifact@v4 + with: + name: nightly-build-artifacts + path: dist/* + compression-level: 6 + if-no-files-found: error + retention-days: 30 + - name: Log artifact location + run: | + echo "Artifacts uploaded to: https://api.github.com/repos/neuralmagic/guidellm/actions/artifacts/${{ steps.artifact-upload.outputs.artifact-id }}" diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml deleted file mode 100644 index 5060149a..00000000 --- a/.github/workflows/quality.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Quality - -on: - push: - branches: - - main - pull_request: - branches: - - '**' - -jobs: - quality-check: - runs-on: ubuntu-latest - strategy: - matrix: - python: - - "3.13" - - "3.9" - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: pip install tox - - name: Run quality checks - run: tox -e quality - - type-check: - runs-on: ubuntu-latest - strategy: - matrix: - python: - - "3.13" - - "3.9" - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: pip install tox - - name: Run type checks - run: tox -e types - - precommit-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - name: Install pre-commit - run: pip install pre-commit - - name: Run pre-commit checks - run: pre-commit run --all-files diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml new file mode 100644 index 00000000..9c740e54 --- /dev/null +++ b/.github/workflows/release-candidate.yml @@ -0,0 +1,103 @@ +name: Release Candidate + +on: + push: + branches: + - 'release/*' + create: + branches: + - 'release/*' + +jobs: + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run unit tests + run: tox -e test-unit + + integration-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run integration tests + run: tox -e test-integration + + e2e-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run end-to-end tests + run: tox -e test-e2e + + build-and-publish: + needs: [unit-tests, integration-tests, e2e-tests] + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install toml loguru tox + - name: Set environment variables + run: | + echo "GUIDELLM_BUILD_TYPE=release_candidate" >> $GITHUB_ENV + echo "GUIDELLM_BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV + - name: Build the package + run: tox -e build + - name: Upload build artifacts + id: artifact-upload + uses: actions/upload-artifact@v4 + with: + name: release-candidate-artifacts + path: dist/* + compression-level: 6 + if-no-files-found: error + retention-days: 30 + - name: Log artifact location + run: | + echo "Artifacts uploaded to: https://api.github.com/repos/neuralmagic/guidellm/actions/artifacts/${{ steps.artifact-upload.outputs.artifact-id }}" + - name: Push wheel to PyPI + uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0 + with: + username: ${{ secrets.PYPI_PUBLIC_USER }} + password: ${{ secrets.PYPI_PUBLIC_AUTH }} + whl: $(find dist -name '*.whl') + - name: Push tar.gz to PyPI + uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0 + with: + username: ${{ secrets.PYPI_PUBLIC_USER }} + password: ${{ secrets.PYPI_PUBLIC_AUTH }} + whl: $(find dist -name '*.tar.gz') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c7c7b8f7..71e33316 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,20 +2,59 @@ name: Release on: push: - branches: - - release/** + tags: + - 'v*.*.*' jobs: + build-and-publish: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install toml loguru tox + - name: Set environment variables + run: | + echo "GUIDELLM_BUILD_TYPE=release" >> $GITHUB_ENV + echo "GUIDELLM_BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV + - name: Build the package + run: tox -e build + - name: Upload build artifacts + id: artifact-upload + uses: actions/upload-artifact@v4 + with: + name: release-artifacts + path: dist/* + compression-level: 6 + if-no-files-found: error + retention-days: 90 + - name: Log artifact location + run: | + echo "Artifacts uploaded to: https://api.github.com/repos/neuralmagic/guidellm/actions/artifacts/${{ steps.artifact-upload.outputs.artifact-id }}" + - name: Push wheel to PyPI + uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0 + with: + username: ${{ secrets.PYPI_PUBLIC_USER }} + password: ${{ secrets.PYPI_PUBLIC_AUTH }} + whl: $(find dist -name '*.whl') + - name: Push tar.gz to PyPI + uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0 + with: + username: ${{ secrets.PYPI_PUBLIC_USER }} + password: ${{ secrets.PYPI_PUBLIC_AUTH }} + whl: $(find dist -name '*.tar.gz') + unit-tests: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.13" - - "3.12" - - "3.11" - - "3.10" - - "3.9" + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -25,18 +64,13 @@ jobs: - name: Install dependencies run: pip install tox - name: Run unit tests - run: tox -e test-unit -- --cov-report=term-missing --cov --cov-fail-under=75 + run: tox -e test-unit integration-tests: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.13" - - "3.12" - - "3.11" - - "3.10" - - "3.9" + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -46,18 +80,13 @@ jobs: - name: Install dependencies run: pip install tox - name: Run integration tests - run: tox -e test-integration -- --cov-report=term-missing --cov --cov-fail-under=75 + run: tox -e test-integration e2e-tests: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.13" - - "3.12" - - "3.11" - - "3.10" - - "3.9" + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -66,5 +95,5 @@ jobs: python-version: ${{ matrix.python }} - name: Install dependencies run: pip install tox - - name: Run e2e tests - run: tox -e test-e2e -- --cov-report=term-missing --cov --cov-fail-under=75 + - name: Run end-to-end tests + run: tox -e test-e2e diff --git a/src/guidellm/scheduler/scheduler.py b/src/guidellm/scheduler/scheduler.py index 15c59bae..06203827 100644 --- a/src/guidellm/scheduler/scheduler.py +++ b/src/guidellm/scheduler/scheduler.py @@ -191,16 +191,21 @@ async def _start_processes( num_processes = min( scheduling_strategy.processes_limit, + scheduling_strategy.processing_requests_limit, + ) + requests_limit_split = ( + scheduling_strategy.processing_requests_limit + // scheduling_strategy.processes_limit + ) + requests_limit_remain = ( scheduling_strategy.processing_requests_limit + % scheduling_strategy.processes_limit ) - requests_limit_split = (scheduling_strategy.processing_requests_limit // - scheduling_strategy.processes_limit) - requests_limit_remain = (scheduling_strategy.processing_requests_limit % - scheduling_strategy.processes_limit) process_ids = (id_ for id_ in range(num_processes)) process_requests_limits = ( requests_limit_split + 1 - if i < requests_limit_remain else requests_limit_split + if i < requests_limit_remain + else requests_limit_split for i in range(num_processes) ) @@ -218,16 +223,16 @@ async def _start_processes( ) ) elif scheduling_strategy.processing_mode == "async": - futures.append( - loop.run_in_executor( - executor, - self.worker.process_loop_asynchronous, - requests_queue, - responses_queue, - requests_limit, - id_, - ) + futures.append( + loop.run_in_executor( + executor, + self.worker.process_loop_asynchronous, + requests_queue, + responses_queue, + requests_limit, + id_, ) + ) else: raise ValueError( f"Invalid processing mode: {scheduling_strategy.processing_mode} " diff --git a/src/guidellm/scheduler/worker.py b/src/guidellm/scheduler/worker.py index efc84572..43cd221b 100644 --- a/src/guidellm/scheduler/worker.py +++ b/src/guidellm/scheduler/worker.py @@ -227,9 +227,7 @@ async def _process_runner(): pending = asyncio.Semaphore(max_concurrency) if pending.locked(): - raise ValueError( - "Async worker called with max_concurrency < 1" - ) + raise ValueError("Async worker called with max_concurrency < 1") while ( process_request := await self.get_request(requests_queue) diff --git a/utils/inject_build_props.py b/utils/inject_build_props.py index 74000dd8..f76a93eb 100644 --- a/utils/inject_build_props.py +++ b/utils/inject_build_props.py @@ -23,19 +23,19 @@ def construct_project_name_and_version(build_type, build_number, current_version ) if build_type == "dev": - project_name = "guidellm_dev" version = f"{current_version}.dev{build_number}" elif build_type == "nightly": - project_name = "guidellm_nightly" date_str = datetime.now().strftime("%Y%m%d") - version = f"{current_version}.{date_str}" + version = f"{current_version}.a{date_str}" + elif build_type == "release_candidate": + date_str = datetime.now().strftime("%Y%m%d") + version = f"{current_version}.rc{date_str}" elif build_type == "release": - project_name = "guidellm" version = current_version else: raise ValueError(f"Unknown build type: {build_type}") - return project_name, version + return "guidellm", version def update_pyproject_toml(project_name, version):