Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/ignition_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ jobs:
--data "$BODY"
- name: Report link
run: |
URL='https://praktika-artifacts-eu-north-1.s3.amazonaws.com/praktika.html?REF=${{ github.ref_name }}&sha=${{ github.sha }}&name_0=Ignition%20Manual%20Style'
URL='https://praktika-artifacts-eu-north-1.s3.amazonaws.com/report.html?REF=${{ github.ref_name }}&sha=${{ github.sha }}&name_0=Ignition%20Manual%20Style'
echo "::notice title=Praktika report::$URL"
echo "[Praktika report]($URL)" >> "$GITHUB_STEP_SUMMARY"
2 changes: 1 addition & 1 deletion .github/workflows/ignition_schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ jobs:
--data "$BODY"
- name: Report link
run: |
URL='https://praktika-artifacts-eu-north-1.s3.amazonaws.com/praktika.html?REF=${{ github.ref_name }}&sha=${{ github.sha }}&name_0=Ignition%20Nightly%20Style'
URL='https://praktika-artifacts-eu-north-1.s3.amazonaws.com/report.html?REF=${{ github.ref_name }}&sha=${{ github.sha }}&name_0=Ignition%20Nightly%20Style'
echo "::notice title=Praktika report::$URL"
echo "[Praktika report]($URL)" >> "$GITHUB_STEP_SUMMARY"
2 changes: 1 addition & 1 deletion ci/infrastructure/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _image_builders():
#
# Bump on any change to the baked venv contents (_runtime_prebuilt_venvs) or
# the baked controller component (_praktika_controller_component).
recipe_version = "1.0.22"
recipe_version = "1.0.23"

return [
Components.create_awslinux_image_builder_config(
Expand Down
98 changes: 98 additions & 0 deletions ci/tests/test_pool_autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,40 @@ def test_pool_autoscaler_builds_scheduled_lambda():
)


def test_pool_autoscaler_wires_scale_coefficient_from_runner_pool():
eager_pool = RunnerPool(
name="arm-eager",
instance_type="t4g.small",
vpc_name="praktika-ci",
scaling=RunnerPool.Scaling.Auto,
scale_coefficient=1.0,
size=0,
max_size=50,
)
default_pool = RunnerPool(
name="arm-default",
instance_type="t4g.small",
vpc_name="praktika-ci",
scaling=RunnerPool.Scaling.Auto,
size=0,
max_size=50,
)

autoscaler = PoolAutoscaler.from_pools([eager_pool, default_pool])
env = autoscaler.lambda_config.environments["POOLS_CONFIG_JSON"]
assert '"scale_coefficient":1.0' in env
assert '"scale_coefficient":0.3' in env


def test_pool_autoscaler_rejects_out_of_range_coefficient():
import pytest

with pytest.raises(ValueError, match="scale_coefficient"):
PoolAutoscaler(pools=[PoolAutoscaler.Pool(name="arm", scale_coefficient=0)])
with pytest.raises(ValueError, match="scale_coefficient"):
PoolAutoscaler(pools=[PoolAutoscaler.Pool(name="arm", scale_coefficient=1.5)])


def test_rate_expression_clamps_to_minute():
assert _rate_expression_for_seconds(0) == "rate(1 minute)"
assert _rate_expression_for_seconds(60) == "rate(1 minute)"
Expand Down Expand Up @@ -150,6 +184,70 @@ def test_calculate_desired_capacity_steps_by_30_percent_of_gap():
)


def test_calculate_desired_capacity_coefficient_one_closes_whole_gap_at_once():
# scale_coefficient=1.0 provisions one instance per queued/in-flight task in a
# single invocation instead of the 30% ramp, capped only at max_size.
assert (
_calculate_desired_capacity(
current_desired=0,
max_size=1000,
visible_messages=100,
in_flight_messages=0,
scale_coefficient=1.0,
)
== 100
)
# Reserve sits on top of the per-task capacity, same as the default ramp.
assert (
_calculate_desired_capacity(
current_desired=2,
max_size=1000,
visible_messages=10,
in_flight_messages=5,
capacity_reserve=2,
scale_coefficient=1.0,
)
== 17
)
# Still capped at max_size and still scale-up only.
assert (
_calculate_desired_capacity(
current_desired=0,
max_size=5,
visible_messages=100,
in_flight_messages=0,
scale_coefficient=1.0,
)
== 5
)


def test_calculate_desired_capacity_coefficient_sets_step_fraction():
# An intermediate coefficient covers that fraction of the outstanding gap,
# rounded up. Half of a 100-task gap -> 50.
assert (
_calculate_desired_capacity(
current_desired=0,
max_size=1000,
visible_messages=100,
in_flight_messages=0,
scale_coefficient=0.5,
)
== 50
)
# The fraction floors to at least +1 near the target so it still converges.
assert (
_calculate_desired_capacity(
current_desired=0,
max_size=1000,
visible_messages=2,
in_flight_messages=0,
scale_coefficient=0.1,
)
== 1
)


def test_calculate_desired_capacity_never_scales_down():
assert (
_calculate_desired_capacity(
Expand Down
2 changes: 1 addition & 1 deletion ci/tests/test_sweep_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def test_workflow_config_cache_success_skips_job_with_report_check(monkeypatch):
assert per_job["name"] == "Pull Request CI / Formatting"
assert per_job["completed"][0]["conclusion"] == "skipped"
details_url = per_job["completed"][0]["details_url"]
assert details_url.startswith("https://silk-reports/praktika.html?PR=69")
assert details_url.startswith("https://silk-reports/report.html?PR=69")
assert "sha=f3ffcfe0c728a75081fe1b6f168a43ad1e564a01" in details_url
assert "name_0=Pull%20Request%20CI" in details_url
assert "name_1=Formatting" in details_url
Expand Down
2 changes: 1 addition & 1 deletion ci/workflows/praktika_pr_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"python3 -m praktika review --provider bedrock-openai "
"--model global.openai.gpt-5.6-sol --reasoning-effort high "
"--prompt ./ci/prompts/code_review.md --fail-for-draft-pr "
"--fail-on-blocking"
"--fail-on-blocking --enable-approve"
),
allow_failure=True,
enable_gh_auth=True,
Expand Down
20 changes: 20 additions & 0 deletions docs/performance-tuning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Performance tuning

Tunings praktika bakes in, and their trade-offs.

## Runner disk: ext4 fast-mount

Runner AMIs set `journal_data_writeback,nobarrier` as ext4 superblock defaults
(via `tune2fs` at image-build time, `image_builder.py`). This makes `fsync`
nearly free (~3 ms → ~0.3 ms measured), speeding up git/Go object writes, docker
layer extraction, and Postgres commits.

- **Safe because runners are disposable:** the weakened durability only matters
on an unclean crash, and a crashed runner is terminated and replaced, its job
re-run, artifacts live in S3. Single-tenant, so stale blocks never leak. Not
for stateful hosts (e.g. the CIDB server).
- **ext4 only.** XFS (AL2023 roots) has no equivalent: it never journals data
and dropped the `nobarrier` option. Those pools keep default mount (~2 ms
fsync); use an ext4 (Ubuntu) root or the local-NVMe lever
([proposals/runner-nvme-workspace.md](proposals/runner-nvme-workspace.md))
if that matters.
Loading
Loading