Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New GitHub Action for SLO Tests Integration with SDK #513

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/slo-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: SLO Report

on:
workflow_run:
workflows: ['SLO']
types:
- completed

jobs:
ydb-slo-action-report:
runs-on: ubuntu-latest
name: Publish YDB SLO Report
permissions:
contents: read
pull-requests: write
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Publish YDB SLO Report
uses: ydb-platform/ydb-slo-action/report@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_run_id: ${{ github.event.workflow_run.id }}
128 changes: 78 additions & 50 deletions .github/workflows/slo.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,98 @@
name: SLO

on:
push:
branches:
- main
pull_request:
branches: [main]
branches:
- main
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:
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:
workload:
- sync-table
- sync-query

concurrency:
group: slo-${{ github.ref }}-${{ matrix.workload }}
cancel-in-progress: true

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
python-version: '3.8'
cache: 'pip'

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
- 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

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: Initialize YDB SLO
uses: ydb-platform/ydb-slo-action/init@main
with:
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
github_token: ${{ secrets.GITHUB_TOKEN }}
workload_name: ${{ matrix.workload }}
ydb_database_node_count: 5

- name: Prepare SLO Database
run: |
python ./tests/slo/src create grpc://localhost:2135 /Root/testdb

- uses: actions/upload-artifact@v3
if: env.DOCKER_REPO != null
- name: Run SLO Tests
env:
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
REF: '${{ github.head_ref || github.ref }}'
WORKLOAD: '${{ matrix.workload }}'
run: |
python ./tests/slo/src run grpc://localhost:2135 /Root/testdb \
--prom-pgw localhost:9091 \
--report-period 250 \
--time ${{inputs.slo_workload_duration_seconds || 600}} \
--read-rps ${{inputs.slo_workload_read_max_rps || 1000}} \
--write-rps ${{inputs.slo_workload_write_max_rps || 100}} \
--read-timeout 1000 \
--write-timeout 1000

- if: always()
name: Cleanup SLO Database
run: |
python ./tests/slo/src cleanup grpc://localhost:2135 /Root/testdb

- if: always()
name: Store ydb chaos testing logs
run: |
docker logs ydb-chaos > chaos-ydb.log

- if: always()
uses: actions/upload-artifact@v4
with:
name: slo-logs
path: logs/
name: ${{ matrix.workload }}-chaos-ydb.log
path: ./chaos-ydb.log
retention-days: 1
11 changes: 0 additions & 11 deletions tests/slo/Dockerfile

This file was deleted.

10 changes: 5 additions & 5 deletions tests/slo/src/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import threading

from metrics import Metrics, JOB_WRITE_LABEL, JOB_READ_LABEL
from metrics import Metrics, OP_TYPE_WRITE, OP_TYPE_READ

from generator import RowGenerator

Expand Down Expand Up @@ -106,7 +106,7 @@ def check_result(result):
query=query,
params=params,
metrics=metrics,
labels=(JOB_READ_LABEL,),
labels=(OP_TYPE_READ,),
request_settings=request_settings,
retry_settings=retry_setting,
check_result_cb=check_result,
Expand Down Expand Up @@ -163,7 +163,7 @@ def check_result(result):
query=query,
params=params,
metrics=metrics,
labels=(JOB_READ_LABEL,),
labels=(OP_TYPE_READ,),
request_settings=request_settings,
retry_settings=retry_setting,
check_result_cb=check_result,
Expand Down Expand Up @@ -220,7 +220,7 @@ def run_writes(driver, query, row_generator, metrics, limiter, runtime, timeout)
query=query,
params=params,
metrics=metrics,
labels=(JOB_WRITE_LABEL,),
labels=(OP_TYPE_WRITE,),
request_settings=request_settings,
retry_settings=retry_setting,
)
Expand Down Expand Up @@ -285,7 +285,7 @@ def check_result(result):
query=query,
params=params,
metrics=metrics,
labels=(JOB_WRITE_LABEL,),
labels=(OP_TYPE_WRITE,),
request_settings=request_settings,
retry_settings=retry_setting,
check_result_cb=check_result,
Expand Down
Loading
Loading