From f46865fd625c7180362065a2f358f0c5bd5c9074 Mon Sep 17 00:00:00 2001 From: Vladislav Polyakov Date: Sat, 26 Oct 2024 19:19:43 +0300 Subject: [PATCH] ci: migrate to new slo action --- .github/workflows/slo.yml | 109 ++++++++++++++++--------------- tests/slo/Dockerfile | 11 ---- tests/slo/{src => }/__init__.py | 0 tests/slo/{src => }/__main__.py | 0 tests/slo/{src => }/generator.py | 0 tests/slo/{src => }/jobs.py | 0 tests/slo/{src => }/metrics.py | 0 tests/slo/{src => }/options.py | 0 tests/slo/{src => }/runner.py | 4 +- tests/slo/{src => }/summary.py | 0 10 files changed, 58 insertions(+), 66 deletions(-) delete mode 100644 tests/slo/Dockerfile rename tests/slo/{src => }/__init__.py (100%) rename tests/slo/{src => }/__main__.py (100%) rename tests/slo/{src => }/generator.py (100%) rename tests/slo/{src => }/jobs.py (100%) rename tests/slo/{src => }/metrics.py (100%) rename tests/slo/{src => }/options.py (100%) rename tests/slo/{src => }/runner.py (98%) rename tests/slo/{src => }/summary.py (100%) diff --git a/.github/workflows/slo.yml b/.github/workflows/slo.yml index 4ca0adac..bd41ef55 100644 --- a/.github/workflows/slo.yml +++ b/.github/workflows/slo.yml @@ -1,70 +1,73 @@ -name: SLO +name: slo on: + push: + branches: + - main pull_request: - branches: [main] + branches: + - main + - release-* workflow_dispatch: + inputs: + github_pull_request_number: + required: true + slo_workload_duration_seconds: + default: '600' + required: false + slo_workload_read_max_rps: + default: '1000' + required: false + slo_workload_write_max_rps: + default: '100' + required: false jobs: - test-slo: - concurrency: - group: slo-${{ github.ref }} + ydb-slo-action-init: if: (!contains(github.event.pull_request.labels.*.name, 'no slo')) + name: Run YDB SLO Tests runs-on: ubuntu-latest - name: SLO test - permissions: - checks: write - pull-requests: write - contents: read - issues: write + + strategy: + matrix: + sdk: + - py-sync-table + - py-sync-query steps: - name: Checkout repository - uses: actions/checkout@v3 - if: env.DOCKER_REPO != null - env: - DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }} + uses: actions/checkout@v4 - - name: Run SLO - uses: ydb-platform/slo-tests@main - if: env.DOCKER_REPO != null - env: - DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }} - continue-on-error: true + - name: Install Python3 + uses: actions/setup-python@v5 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - KUBECONFIG_B64: ${{ secrets.SLO_KUBE_CONFIG }} - AWS_CREDENTIALS_B64: ${{ secrets.SLO_AWS_CREDENTIALS }} - AWS_CONFIG_B64: ${{ secrets.SLO_AWS_CONFIG }} - DOCKER_USERNAME: ${{ secrets.SLO_DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.SLO_DOCKER_PASSWORD }} - DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }} - DOCKER_FOLDER: ${{ secrets.SLO_DOCKER_FOLDER }} - s3_endpoint: ${{ secrets.SLO_S3_ENDPOINT }} - s3_images_folder: ${{ vars.SLO_S3_IMAGES_FOLDER }} - grafana_domain: ${{ vars.SLO_GRAFANA_DOMAIN }} - grafana_dashboard: ${{ vars.SLO_GRAFANA_DASHBOARD }} - ydb_version: 'newest' - timeBetweenPhases: 30 - shutdownTime: 30 - - language_id0: sync-python-table - language0: Python SDK over Table Service - workload_path0: tests/slo - workload_build_context0: ../.. - workload_build_options0: -f Dockerfile --build-arg SDK_SERVICE=sync-python-table + python-version: '3.8' + cache: 'pip' - language_id1: sync-python-query - language1: Python SDK over Query Service - workload_path1: tests/slo - workload_build_context1: ../.. - workload_build_options1: -f Dockerfile --build-arg SDK_SERVICE=sync-python-query + - name: Install dependencies + run: | + python -m pip install --no-cache-dir --upgrade pip + python -m pip install --no-cache-dir -e . + python -m pip install --no-cache-dir -r tests/slo/requirements.txt - - uses: actions/upload-artifact@v3 - if: env.DOCKER_REPO != null - env: - DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }} + - name: Initialize YDB SLO + uses: ydb-platform/ydb-slo-action/init@main with: - name: slo-logs - path: logs/ + github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }} + github_token: ${{ secrets.GITHUB_TOKEN }} + sdk_name: ${{ matrix.sdk }} + + - name: Run SLO Tests + run: | + python ./tests/slo create grpc://localhost:2135 /Root/testdb + python ./tests/slo run grpc://localhost:2135 /Root/testdb \ + --prom-pgw localhost:9091 \ + --report-period 250 \ + --read-rps ${{inputs.slo_workload_read_max_rps || 1000}} \ + --write-rps ${{inputs.slo_workload_write_max_rps || 100}} \ + --read-timeout 10000 + --write-timeout 10000 + --time ${{inputs.slo_workload_duration_seconds || 600}} \\ + --shutdown-time 30 + python ./tests/slo cleanup grpc://localhost:2135 /Root/testdb \ No newline at end of file diff --git a/tests/slo/Dockerfile b/tests/slo/Dockerfile deleted file mode 100644 index 7a8cc494..00000000 --- a/tests/slo/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.8-slim -COPY . /src -WORKDIR /src -RUN python -m pip install --no-cache-dir --upgrade pip && \ - python -m pip install --no-cache-dir -e . && \ - python -m pip install --no-cache-dir -r tests/slo/requirements.txt -WORKDIR tests/slo -ARG SDK_SERVICE -ENV SDK_SERVICE=$SDK_SERVICE - -ENTRYPOINT ["python", "src"] diff --git a/tests/slo/src/__init__.py b/tests/slo/__init__.py similarity index 100% rename from tests/slo/src/__init__.py rename to tests/slo/__init__.py diff --git a/tests/slo/src/__main__.py b/tests/slo/__main__.py similarity index 100% rename from tests/slo/src/__main__.py rename to tests/slo/__main__.py diff --git a/tests/slo/src/generator.py b/tests/slo/generator.py similarity index 100% rename from tests/slo/src/generator.py rename to tests/slo/generator.py diff --git a/tests/slo/src/jobs.py b/tests/slo/jobs.py similarity index 100% rename from tests/slo/src/jobs.py rename to tests/slo/jobs.py diff --git a/tests/slo/src/metrics.py b/tests/slo/metrics.py similarity index 100% rename from tests/slo/src/metrics.py rename to tests/slo/metrics.py diff --git a/tests/slo/src/options.py b/tests/slo/options.py similarity index 100% rename from tests/slo/src/options.py rename to tests/slo/options.py diff --git a/tests/slo/src/runner.py b/tests/slo/runner.py similarity index 98% rename from tests/slo/src/runner.py rename to tests/slo/runner.py index b9380436..a114842d 100644 --- a/tests/slo/src/runner.py +++ b/tests/slo/runner.py @@ -91,13 +91,13 @@ def run_slo(args, driver, tb_name): logger.info("Max ID: %s", max_id) metrics = Metrics(args.prom_pgw) - if SDK_SERVICE_NAME == "sync-python-table": + if SDK_SERVICE_NAME == "py-sync-table": futures = ( *run_read_jobs(args, driver, tb_name, max_id, metrics), *run_write_jobs(args, driver, tb_name, max_id, metrics), run_metric_job(args, metrics), ) - elif SDK_SERVICE_NAME == "sync-python-query": + elif SDK_SERVICE_NAME == "py-sync-query": futures = ( *run_read_jobs_query(args, driver, tb_name, max_id, metrics), *run_write_jobs_query(args, driver, tb_name, max_id, metrics), diff --git a/tests/slo/src/summary.py b/tests/slo/summary.py similarity index 100% rename from tests/slo/src/summary.py rename to tests/slo/summary.py