Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
New flakiness dashboard should generate JSON in the background process
https://bugs.webkit.org/show_bug.cgi?id=123797 Reviewed by Alexey Proskuryakov. * config.json: Add defaultBuildWaitInterval used by process-builds.php. * init-database.sql: Add is_process column to builds table so that we can track of "unprocessed" builds. * public/admin/process-builds.php: Added. (process_latest_five_builds): Update flakiness states and generate JSONs for the latest five builds. We go backwards in the time so that we don't end up infinite looping over a single build that fails. (main): Call processed_builds with an exponential back off. * public/api/report.php: (store_results): No need to return build or builder ids. (main): Don't update flakiness states or generate JSONs. * public/include/test-results.php: (add_build): Take the slave name; it doesn't make any sense to create a build without it and later updating it in store_test_results. (store_test_results): Once new test results are added, explicitly mark this build as unprocessed. Canonical link: https://commits.webkit.org/142130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
6 changed files
with
99 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
require_once('../include/test-results.php'); | ||
|
||
ignore_user_abort(true); | ||
set_time_limit(0); | ||
|
||
function process_latest_five_builds($db) { | ||
$build_rows = $db->query_and_fetch_all('SELECT id, builder FROM builds | ||
WHERE start_time IS NOT NULL AND is_processed = FALSE ORDER BY end_time DESC LIMIT 5'); | ||
if (!$build_rows) | ||
return FALSE; | ||
|
||
foreach ($build_rows as $row) { | ||
echo "Build {$row['id']} for builder {$row['builder']}:\n"; | ||
echo " Updating flakiness..."; | ||
flush(); | ||
|
||
$start_time = microtime(true); | ||
update_flakiness_after_inserting_build($db, $row['id']); | ||
$time = microtime(true) - $start_time; | ||
|
||
echo "($time s)\n"; | ||
echo " Generating JSONs..."; | ||
flush(); | ||
|
||
$start_time = microtime(true); | ||
$generator = new ResultsJSONGenerator($db, $row['builder']); | ||
$generator->generate('wrongexpectations'); | ||
$generator->generate('flaky'); | ||
$time = microtime(true) - $start_time; | ||
|
||
echo "($time s)\n"; | ||
flush(); | ||
|
||
$db->query_and_get_affected_rows('UPDATE builds SET is_processed = TRUE where id = $1', array($row['id'])); | ||
|
||
sleep(1); | ||
} | ||
|
||
return TRUE; | ||
} | ||
|
||
function main() { | ||
$db = new Database; | ||
if (!$db->connect()) { | ||
echo "Failed to connect to the database"; | ||
exit(1); | ||
} | ||
|
||
$wait = config('defaultBuildWaitInterval'); | ||
while (1) { | ||
if (process_latest_five_builds($db)) | ||
$wait = max(1, $wait * 0.8); | ||
else | ||
$wait *= 2; | ||
echo "Sleeping $wait s...\n"; | ||
sleep($wait); | ||
} | ||
} | ||
|
||
main(); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters