Skip to content

Commit ff6a8a7

Browse files
Update CICD logic (#9725)
* Update CICD logic Attempts to address #9682 * Check Spiral * [ci fw-only PHP/spiral] Attempt this again * [ci fw-only PHP/spiral] Correct the CICD logic * [ci fw-only PHP/spiral] Correct the CICD logic * [ci fw-only PHP/spiral] Add logging * [ci fw-only PHP/spiral] Add env var to dockerfile * [ci fw-only PHP/spiral] Pass through to Docker * [ci fw-only PHP/spiral] Maybe this is less dumb
1 parent c82a834 commit ff6a8a7

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
# run-ci.py runs the diffing to see if github actions needs to test this framework. Ideally/eventually,
156156
# we'd like to try and do the diffing before github_actions_clean & setup.
157157
# This will run the tests exactly as you would in your own vm:
158-
docker network create tfb > /dev/null 2>&1 && docker run --network=tfb -e USER_ID=$(id -u) -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=`pwd`,target=/FrameworkBenchmarks techempower/tfb --mode verify --test-dir $RUN_TESTS --results-environment Github-Actions;
158+
docker network create tfb > /dev/null 2>&1 && docker run --network=tfb -e USER_ID=$(id -u) -e CI=true -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=`pwd`,target=/FrameworkBenchmarks techempower/tfb --mode verify --test-dir $RUN_TESTS --results-environment Github-Actions;
159159
dependabot:
160160
needs: verify
161161
runs-on: ubuntu-latest

toolset/test_types/verifications.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def verify_updates(old_worlds, new_worlds, updates_expected, url):
326326
return problems
327327

328328

329-
def verify_query_cases(self, cases, url, check_updates=False):
329+
def verify_query_cases(test_instance, cases, url, check_updates=False):
330330
'''
331331
The /updates and /queries tests accept a `queries` parameter
332332
that is expected to be between 1-500.
@@ -352,19 +352,19 @@ def verify_query_cases(self, cases, url, check_updates=False):
352352
MIN = 1
353353
# Initialization for query counting
354354
repetitions = 1
355-
concurrency = max(self.config.concurrency_levels)
355+
concurrency = max(test_instance.config.concurrency_levels)
356356
expected_queries = 20 * repetitions * concurrency
357357
expected_rows = expected_queries
358358

359359
# Only load in the World table if we are doing an Update verification
360360
world_db_before = {}
361361
if check_updates:
362-
world_db_before = databases[self.database.lower()].get_current_world_table(self.config)
362+
world_db_before = databases[test_instance.database.lower()].get_current_world_table(test_instance.config)
363363
expected_queries = expected_queries + concurrency * repetitions # eventually bulk updates!
364364

365365
for q, max_infraction in cases:
366366
case_url = url + q
367-
headers, body, status = self.request_headers_and_body_and_status(case_url)
367+
headers, body, status = test_instance.request_headers_and_body_and_status(case_url)
368368

369369
try:
370370
queries = int(q) # drops down for 'foo' and ''
@@ -378,14 +378,14 @@ def verify_query_cases(self, cases, url, check_updates=False):
378378

379379
problems += verify_randomnumber_list(expected_len, headers, body,
380380
case_url, max_infraction)
381-
problems += verify_headers(self.request_headers_and_body_and_status, headers, case_url)
381+
problems += verify_headers(test_instance.request_headers_and_body_and_status, headers, case_url)
382382

383383
# Only check update changes if we are doing an Update verification and if we're testing
384384
# the highest number of queries, to ensure that we don't accidentally FAIL for a query
385385
# that only updates 1 item and happens to set its randomNumber to the same value it
386386
# previously held
387387
if check_updates and queries >= MAX:
388-
world_db_after = databases[self.database.lower()].get_current_world_table(self.config)
388+
world_db_after = databases[test_instance.database.lower()].get_current_world_table(test_instance.config)
389389
problems += verify_updates(world_db_before, world_db_after,
390390
MAX, case_url)
391391

@@ -408,16 +408,16 @@ def verify_query_cases(self, cases, url, check_updates=False):
408408
# parameter input
409409
problems += verify_randomnumber_list(
410410
expected_len, headers, body, case_url, max_infraction)
411-
problems += verify_headers(self.request_headers_and_body_and_status, headers, case_url)
411+
problems += verify_headers(test_instance.request_headers_and_body_and_status, headers, case_url)
412412

413-
if hasattr(self, 'database'):
413+
if hasattr(test_instance, 'database'):
414414
# verify the number of queries and rows read for 20 queries, with a concurrency level of 512, with 2 repetitions
415-
problems += verify_queries_count(self, "world", url + "20", concurrency, repetitions, expected_queries,
415+
problems += verify_queries_count(test_instance, "world", url + "20", concurrency, repetitions, expected_queries,
416416
expected_rows, check_updates)
417417
return problems
418418

419419

420-
def verify_queries_count(self, tbl_name, url, concurrency=512, count=2, expected_queries=1024, expected_rows=1024,
420+
def verify_queries_count(test_instance, tbl_name, url, concurrency=512, count=2, expected_queries=1024, expected_rows=1024,
421421
check_updates=False):
422422
'''
423423
Checks that the number of executed queries, at the given concurrency level,
@@ -431,20 +431,20 @@ def verify_queries_count(self, tbl_name, url, concurrency=512, count=2, expected
431431

432432
problems = []
433433

434-
queries, rows, rows_updated, margin, trans_failures = databases[self.database.lower()].verify_queries(self.config,
435-
tbl_name, url,
436-
concurrency,
437-
count,
438-
check_updates)
434+
queries, rows, rows_updated, margin, trans_failures = databases[test_instance.database.lower()].verify_queries(test_instance.config,
435+
tbl_name, url,
436+
concurrency,
437+
count,
438+
check_updates)
439439

440440
isBulk = check_updates and (queries < 1.001 * expected_queries) and (queries > 0.999 * expected_queries)
441441

442442
if check_updates and not isBulk: # Restore the normal queries number if bulk queries are not used
443443
expected_queries = (expected_queries - count * concurrency) * 2
444444

445-
# Add a margin based on the number of cpu cores
446-
queries_margin = 1.015 # For a run on Travis
447-
if multiprocessing.cpu_count() > 2:
445+
# Add a margin based on whether we're running in a CI environment
446+
queries_margin = 1.015 # For a run in CI environment
447+
if not test_instance.config.is_ci:
448448
queries_margin = 1 # real run (Citrine or Azure) -> no margin on queries
449449
# Check for transactions failures (socket errors...)
450450
if trans_failures > 0:

toolset/utils/benchmark_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def __init__(self, args):
2222
else:
2323
self.types = {t: types[t] for t in args.type}
2424

25+
# Check if we're running in a CI environment
26+
self.is_ci = os.getenv('CI')
2527
self.duration = args.duration
2628
self.exclude = args.exclude
2729
self.quiet = args.quiet

0 commit comments

Comments
 (0)