Skip to content

Commit

Permalink
refactor: rename sdk to workload in SLO workflows and metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
polRk committed Nov 25, 2024
1 parent 60f284f commit c544f3b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/slo-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
- name: Publish YDB SLO Report
uses: ydb-platform/ydb-slo-action/report@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_run_id: ${{ github.event.workflow_run.id }}
26 changes: 13 additions & 13 deletions .github/workflows/slo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:

strategy:
matrix:
sdk:
- py-sync-table
- py-sync-query
workload:
- sync-table
- sync-query

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

steps:
Expand All @@ -59,7 +59,7 @@ jobs:
with:
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
github_token: ${{ secrets.GITHUB_TOKEN }}
sdk_name: ${{ matrix.sdk }}
workload_name: ${{ matrix.workload }}
ydb_database_node_count: 5

- name: Prepare SLO Database
Expand All @@ -69,7 +69,7 @@ jobs:
- name: Run SLO Tests
env:
REF: '${{ github.head_ref || github.ref }}'
SDK_SERVICE: '${{ matrix.sdk }}'
WORKLOAD: '${{ matrix.workload }}'
run: |
python ./tests/slo/src run grpc://localhost:2135 /Root/testdb \
--prom-pgw localhost:9091 \
Expand All @@ -78,7 +78,12 @@ jobs:
--read-rps ${{inputs.slo_workload_read_max_rps || 1000}} \
--write-rps ${{inputs.slo_workload_write_max_rps || 100}} \
--read-timeout 1000 \
--write-timeout 1000 || true
--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
Expand All @@ -88,11 +93,6 @@ jobs:
- if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.sdk }}-chaos-ydb.log
name: ${{ matrix.workload }}-chaos-ydb.log
path: ./chaos-ydb.log
retention-days: 1

- if: always()
name: Cleanup SLO Database
run: |
python ./tests/slo/src cleanup grpc://localhost:2135 /Root/testdb || true
8 changes: 5 additions & 3 deletions tests/slo/src/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
OP_STATUS_SUCCESS, OP_STATUS_FAILURE = "success", "err"

REF = environ.get("REF", "main")
SDK_SERVICE_NAME = environ.get("SDK_SERVICE", "py-sync-table")
WORKLOAD = environ.get("WORKLOAD", "sync-query")


class Metrics:
Expand Down Expand Up @@ -151,12 +151,14 @@ def stop(self, labels, start_time, attempts=1, error=None):
def push(self):
push_to_gateway(
self._push_gtw,
job=f"workload-{SDK_SERVICE_NAME}",
job=f"workload-{WORKLOAD_NAME}",
registry=self._registry,
grouping_key={
"ref": REF,
"sdk": SDK_SERVICE_NAME,
"sdk": "ydb-python-sdk",
"sdk_version": version("ydb"),
"workload": WORKLOAD_NAME,
"workload_version": "0.0.0",
},
)

Expand Down
8 changes: 4 additions & 4 deletions tests/slo/src/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
run_write_jobs_query,
run_metric_job,
)
from metrics import Metrics, SDK_SERVICE_NAME
from metrics import Metrics, WORKLOAD

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -91,20 +91,20 @@ def run_slo(args, driver, tb_name):
logger.info("Max ID: %s", max_id)

metrics = Metrics(args.prom_pgw)
if SDK_SERVICE_NAME == "py-sync-table":
if WORKLOAD == "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 == "py-sync-query":
elif WORKLOAD == "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),
run_metric_job(args, metrics),
)
else:
raise ValueError(f"Unsupported service: {SDK_SERVICE_NAME}")
raise ValueError(f"Unsupported service: {WORKLOAD}")

for future in futures:
future.join()
Expand Down

0 comments on commit c544f3b

Please sign in to comment.