haikuwebkit/Websites/perf.webkit.org/tools/run-analysis.js

88 lines
3.8 KiB
JavaScript
Raw Permalink Normal View History

Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
#!/usr/local/bin/node
const fs = require('fs');
const parseArguments = require('./js/parse-arguments.js').parseArguments;
const RemoteAPI = require('./js/remote.js').RemoteAPI;
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
const MeasurementSetAnalyzer = require('./js/measurement-set-analyzer.js').MeasurementSetAnalyzer;
const AnalysisResultsNotifier = require('./js/analysis-results-notifier.js').AnalysisResultsNotifier;
const Subprocess = require('./js/subprocess.js').Subprocess;
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
require('./js/v3-models.js');
global.PrivilegedAPI = require('./js/privileged-api.js').PrivilegedAPI;
function main(argv)
{
const options = parseArguments(argv, [
{name: '--server-config-json', required: true},
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
{name: '--notification-config-json', required: true},
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
{name: '--analysis-range-in-days', type: parseFloat, default: 10},
{name: '--seconds-to-sleep', type: parseFloat, default: 1200},
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
{name: '--max-retry-factor', type: parseFloat, default: 3},
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
]);
if (!options)
return;
analysisLoop(options);
}
async function analysisLoop(options)
{
const secondsToSleep = options['--seconds-to-sleep'];
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
try {
const serverConfig = JSON.parse(fs.readFileSync(options['--server-config-json'], 'utf-8'));
const analysisRangeInDays = options['--analysis-range-in-days'];
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
global.RemoteAPI = new RemoteAPI(serverConfig.server);
[perf dashboard] Remove non-inclusive words from perf dashboard. https://bugs.webkit.org/show_bug.cgi?id=223505 Reviewed by Ryosuke Niwa. Removed most of non-inclusive terminology and replaced it with 'worker'. Make impacted APIs backward compatible during transition. The non-inclusive terminology will be removed after transition. * ReadMe.md: Removed non-inclusive words. * init-database.sql: Rename tables with non-inclusive words. * migrate-database.sql: Added migration SQL for existing database. * public/admin/build-workers.php: Renamed from Websites/perf.webkit.org/public/admin/build-slaves.php. * public/api/build-requests.php: * public/api/measurement-set.php: * public/api/report-commits.php: * public/api/runs.php: * public/api/update-triggerable.php: * public/api/upload-root.php: * public/include/admin-header.php: * public/include/json-header.php: * public/include/report-processor.php: * public/privileged-api/add-build-requests.php: * public/privileged-api/create-analysis-task.php: * public/privileged-api/create-test-group.php: * public/privileged-api/update-test-group.php: * public/v2/js/ember.js: * server-tests/api-build-requests-tests.js: * server-tests/api-commits-tests.js: * server-tests/api-report-commits-tests.js: * server-tests/api-report-tests.js: (emptyReport): (reportWitMismatchingCommitTime): (reportWithOneSecondCommitTimeDifference): (emptyWorkerReport): (emptySlaveReport): Deleted. * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (updateWithOSXRepositoryGroup): (updateWithMacWebKitRepositoryGroups): * server-tests/api-upload-root-tests.js: (makeReport): (addWorkerAndCreateRootFile): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (async addTriggerableAndCreateTask): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): (async addTriggerableAndCreateTask): * server-tests/resources/common-operations.js: * server-tests/resources/mock-data.js: (MockData.addMockConfiguration): (MockData.set mockTestSyncConfigWithSingleBuilder): (MockData.sampleBuildData): * server-tests/resources/test-server.js: (TestServer.prototype.testConfig): * server-tests/tools-buildbot-triggerable-tests.js: * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (createTriggerable): * tools/detect-changes.js: (loadServerConfig): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.buildTag): (BuildbotSyncer): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): (BuildbotSyncer.prototype.pullBuildbot): (BuildbotSyncer._loadConfig): (BuildbotSyncer._validateAndMergeConfig): (BuildbotBuildEntry.prototype.slaveName): Deleted. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): (BuildbotTriggerable.prototype.updateTriggerable): (BuildbotTriggerable.prototype.async syncOnce): (BuildbotTriggerable.prototype.async _scheduleRequest): (BuildbotTriggerable.prototype._scheduleRequestIfWorkerIsAvailable): (BuildbotTriggerable.prototype._scheduleRequestWithLog): (BuildbotTriggerable._testGroupMapForBuildRequests): (BuildbotTriggerable.prototype._scheduleRequestIfSlaveIsAvailable): Deleted. * tools/js/database.js: * tools/js/os-build-fetcher.js: (prototype.async _reportCommits): * tools/js/privileged-api.js: (NodePrivilegedAPI.prototype.sendRequest): (NodePrivilegedAPI.configure): (NodePrivilegedAPI): * tools/pull-os-versions.py: (OSBuildFetcher.fetch_and_report_new_builds): * tools/run-analysis.js: (async analysisLoop): * tools/sync-buildbot.js: (syncLoop.const.makeTriggerable): (syncLoop): * tools/sync-commits.py: (Repository.fetch_commits_and_submit): * tools/sync-os-versions.js: (syncLoop): * tools/util.py: (submit_commits): * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: (sampleiOSConfig): (sampleBuildData): (async const): * unit-tests/checkconfig.js: * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/privileged-api-tests.js: * unit-tests/retry-failed-build-requests-tests.js: * unit-tests/test-groups-tests.js: Canonical link: https://commits.webkit.org/235601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-22 21:23:38 +00:00
PrivilegedAPI.configure(serverConfig.worker.name, serverConfig.worker.password);
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
const manifest = await Manifest.fetch();
const measurementSetList = MeasurementSetAnalyzer.measurementSetListForAnalysis(manifest);
const endTime = Date.now();
const startTime = endTime - analysisRangeInDays * 24 * 3600 * 1000;
const analyzer = new MeasurementSetAnalyzer(measurementSetList, startTime, endTime, console);
console.log(`Start analyzing last ${analysisRangeInDays} days measurement sets.`);
await analyzer.analyzeOnce();
} catch (error) {
console.error(`Failed to analyze measurement sets due to ${error}`);
}
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
[perf dashboard] Add sequential mode for perf dashboard A/B testing. https://bugs.webkit.org/show_bug.cgi?id=223886 Reviewed by Ryosuke Niwa. Add 'testgroup_repetition_type' to 'analysis_test_groups' table to store repetition type which defaults to 'alternating'. Add support to schedule 'sequential' A/B testing which schedules all iterations for the first configuration (A) before the iterations for the second configuration (B). Before this patch, all A/B testing alternated between two different configurations for each iteration. Add retry logic for 'sequential' A/B testing. Update syncing script to not proceed with next configuration the current configuration successfully completed more iterations than the initially requested or retries exceeded the list. Fix a potential race in syncing script that 'Promise.all' may cause test group not scheduled in order. * browser-tests/test-group-form-tests.js: Updated and added unit tests. * init-database.sql: Added 'testgroup_repetition_type' field to 'analysis_test_groups' table. * migrate-database.sql: Updated migration script to conditionally add 'testgroup_repetition_type' field. * public/api/test-groups.php: Added 'repetitionType' field in api return value. * public/include/build-requests-fetcher.php: Fetching build requests under a triggerable should include test group with all test groups finished but still need retry. This will allow syncing script to resolve the build request by ID and block other request to be scheduled on the builder. * public/include/commit-sets-helpers.php: Added code to create build requests based on test mode. * public/privileged-api/add-build-requests.php: Added support to only add build requests to one commit set. * public/privileged-api/create-analysis-task.php: Added 'repetitionType' support. * public/privileged-api/create-test-group.php: Added 'repetitionType' support. * public/privileged-api/update-test-group.php: * public/shared/common-component-base.js: * public/v3/components/custom-configuration-test-group-form.js: Added 'repetitionType' support. (CustomConfigurationTestGroupForm.prototype.startTesting): * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): * public/v3/components/test-group-form.js: (TestGroupForm.prototype.startTesting): * public/v3/models/analysis-task.js: (AnalysisTask.async create): (AnalysisTask): * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.updateSingleton): Allow build request order to be updated. * public/v3/models/test-group.js: (TestGroup): (TestGroup.prototype.updateSingleton): (TestGroup.prototype.repetitionType): (TestGroup.prototype.repetitionCountForCommitSet): Refactored `repetitionCount` since repetition may be different between configurations. (TestGroup.prototype.hasRetries): A helper function to tell if a test group has retry runs. (TestGroup.prototype.additionalRepetitionNeededToReachInitialRepetitionCount): (TestGroup.prototype.successfulTestCount): (TestGroup.prototype.isFirstTestRequest): (TestGroup.prototype.precedingBuildRequest): (TestGroup.prototype.retryCountForCommitSet): (TestGroup.prototype.retryCountsAreSameForAllCommitSets): (TestGroup.prototype.async _createAlternatingRetriesForTestGroup): Moved from 'retry-failed-build-requests' module. (TestGroup.async _createSequentialRetriesForTestGroup): Moved from 'retry-failed-build-requests' module. (TestGroup.prototype.async cancelPendingRequests): (TestGroup.prototype.async didSendNotification): (TestGroup.prototype.async addMoreBuildRequests): (TestGroup.async createWithTask): (TestGroup.async createWithCustomConfiguration): (TestGroup.async createAndRefetchTestGroups): (TestGroup.prototype.async scheduleMoreRequestsOrClearFlag): Moved from 'retry-failed-build-requests' module. (TestGroup.async fetchById): Added support to fetch test group by ID. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskConfiguratorPane.prototype.setTestGroups): (AnalysisTaskConfiguratorPane): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype._renderCurrentTestGroup): (AnalysisTaskTestGroupPane.prototype._retrySummary): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.async _retryCurrentTestGroup): (AnalysisTaskPage.prototype.async _bisectCurrentTestGroup): (AnalysisTaskPage.set const): (AnalysisTaskPage.prototype.async _createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype.async _createCustomTestGroup): * public/v3/pages/chart-pane.js: (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async _analyzeRange): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.async _createAnalysisTaskWithGroup): * server-tests/api-build-requests-tests.js: Added a unit test. * server-tests/api-upload-root-tests.js: Updated unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Updated and added unit tests. * server-tests/privileged-api-create-analysis-task-tests.js: Added unit tests. * server-tests/privileged-api-create-test-group-tests.js: Updated and added unit tests. * server-tests/privileged-api-update-test-group-tests.js: Updated and added unit tests. * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/mock-data.js: (MockData.addMockData): (MockData.set addMockBuildRequestsWithRoots): (MockData.set addAnotherMockTestGroup): (MockData.set mockTestSyncConfigWithSingleBuilder): (MockData.sampleBuildData): * server-tests/tools-buildbot-triggerable-tests.js: Updated and added unit tests. * server-tests/tools-sync-buildbot-integration-tests.js: Updated unit tests. (async createTestGroupWithPatch): (createTestGroupWihOwnedCommit): * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): (BuildbotSyncer.prototype.pullBuildbot): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): (BuildbotTriggerable.prototype.async syncOnce): (BuildbotTriggerable.prototype.async _scheduleRequest): (BuildbotTriggerable.prototype._shouldDeferSequentialTestingRequestWithNewCommitSet): * tools/js/measurement-set-analyzer.js: (MeasurementSetAnalyzer.prototype.async _analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/retry-failed-build-requests.js: Removed. * tools/run-analysis.js: Use updated API to retry. (async analysisLoop): (async processTestGroupMayNeedMoreRequests): * tools/sync-buildbot.js: Added command line option '--max-retry-factor'. * unit-tests/analysis-task-tests.js: Updated unit tests. * unit-tests/buildbot-syncer-tests.js: Updated unit tests. (createSampleBuildRequest): * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/retry-failed-build-requests-tests.js: Moved unit tests to test-group-tests.js. * unit-tests/test-groups-tests.js: Added unit tests from 'retry-failed-build-requests-tests.js'. Canonical link: https://commits.webkit.org/238151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 01:23:22 +00:00
const maxRetryFactor = options['--max-retry-factor'];
const testGroupsMayNeedMoreRequests = await TestGroup.fetchAllThatMayNeedMoreRequests();
try {
[perf dashboard] Add sequential mode for perf dashboard A/B testing. https://bugs.webkit.org/show_bug.cgi?id=223886 Reviewed by Ryosuke Niwa. Add 'testgroup_repetition_type' to 'analysis_test_groups' table to store repetition type which defaults to 'alternating'. Add support to schedule 'sequential' A/B testing which schedules all iterations for the first configuration (A) before the iterations for the second configuration (B). Before this patch, all A/B testing alternated between two different configurations for each iteration. Add retry logic for 'sequential' A/B testing. Update syncing script to not proceed with next configuration the current configuration successfully completed more iterations than the initially requested or retries exceeded the list. Fix a potential race in syncing script that 'Promise.all' may cause test group not scheduled in order. * browser-tests/test-group-form-tests.js: Updated and added unit tests. * init-database.sql: Added 'testgroup_repetition_type' field to 'analysis_test_groups' table. * migrate-database.sql: Updated migration script to conditionally add 'testgroup_repetition_type' field. * public/api/test-groups.php: Added 'repetitionType' field in api return value. * public/include/build-requests-fetcher.php: Fetching build requests under a triggerable should include test group with all test groups finished but still need retry. This will allow syncing script to resolve the build request by ID and block other request to be scheduled on the builder. * public/include/commit-sets-helpers.php: Added code to create build requests based on test mode. * public/privileged-api/add-build-requests.php: Added support to only add build requests to one commit set. * public/privileged-api/create-analysis-task.php: Added 'repetitionType' support. * public/privileged-api/create-test-group.php: Added 'repetitionType' support. * public/privileged-api/update-test-group.php: * public/shared/common-component-base.js: * public/v3/components/custom-configuration-test-group-form.js: Added 'repetitionType' support. (CustomConfigurationTestGroupForm.prototype.startTesting): * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): * public/v3/components/test-group-form.js: (TestGroupForm.prototype.startTesting): * public/v3/models/analysis-task.js: (AnalysisTask.async create): (AnalysisTask): * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.updateSingleton): Allow build request order to be updated. * public/v3/models/test-group.js: (TestGroup): (TestGroup.prototype.updateSingleton): (TestGroup.prototype.repetitionType): (TestGroup.prototype.repetitionCountForCommitSet): Refactored `repetitionCount` since repetition may be different between configurations. (TestGroup.prototype.hasRetries): A helper function to tell if a test group has retry runs. (TestGroup.prototype.additionalRepetitionNeededToReachInitialRepetitionCount): (TestGroup.prototype.successfulTestCount): (TestGroup.prototype.isFirstTestRequest): (TestGroup.prototype.precedingBuildRequest): (TestGroup.prototype.retryCountForCommitSet): (TestGroup.prototype.retryCountsAreSameForAllCommitSets): (TestGroup.prototype.async _createAlternatingRetriesForTestGroup): Moved from 'retry-failed-build-requests' module. (TestGroup.async _createSequentialRetriesForTestGroup): Moved from 'retry-failed-build-requests' module. (TestGroup.prototype.async cancelPendingRequests): (TestGroup.prototype.async didSendNotification): (TestGroup.prototype.async addMoreBuildRequests): (TestGroup.async createWithTask): (TestGroup.async createWithCustomConfiguration): (TestGroup.async createAndRefetchTestGroups): (TestGroup.prototype.async scheduleMoreRequestsOrClearFlag): Moved from 'retry-failed-build-requests' module. (TestGroup.async fetchById): Added support to fetch test group by ID. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskConfiguratorPane.prototype.setTestGroups): (AnalysisTaskConfiguratorPane): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype._renderCurrentTestGroup): (AnalysisTaskTestGroupPane.prototype._retrySummary): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.async _retryCurrentTestGroup): (AnalysisTaskPage.prototype.async _bisectCurrentTestGroup): (AnalysisTaskPage.set const): (AnalysisTaskPage.prototype.async _createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype.async _createCustomTestGroup): * public/v3/pages/chart-pane.js: (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async _analyzeRange): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.async _createAnalysisTaskWithGroup): * server-tests/api-build-requests-tests.js: Added a unit test. * server-tests/api-upload-root-tests.js: Updated unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Updated and added unit tests. * server-tests/privileged-api-create-analysis-task-tests.js: Added unit tests. * server-tests/privileged-api-create-test-group-tests.js: Updated and added unit tests. * server-tests/privileged-api-update-test-group-tests.js: Updated and added unit tests. * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/mock-data.js: (MockData.addMockData): (MockData.set addMockBuildRequestsWithRoots): (MockData.set addAnotherMockTestGroup): (MockData.set mockTestSyncConfigWithSingleBuilder): (MockData.sampleBuildData): * server-tests/tools-buildbot-triggerable-tests.js: Updated and added unit tests. * server-tests/tools-sync-buildbot-integration-tests.js: Updated unit tests. (async createTestGroupWithPatch): (createTestGroupWihOwnedCommit): * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): (BuildbotSyncer.prototype.pullBuildbot): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): (BuildbotTriggerable.prototype.async syncOnce): (BuildbotTriggerable.prototype.async _scheduleRequest): (BuildbotTriggerable.prototype._shouldDeferSequentialTestingRequestWithNewCommitSet): * tools/js/measurement-set-analyzer.js: (MeasurementSetAnalyzer.prototype.async _analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/retry-failed-build-requests.js: Removed. * tools/run-analysis.js: Use updated API to retry. (async analysisLoop): (async processTestGroupMayNeedMoreRequests): * tools/sync-buildbot.js: Added command line option '--max-retry-factor'. * unit-tests/analysis-task-tests.js: Updated unit tests. * unit-tests/buildbot-syncer-tests.js: Updated unit tests. (createSampleBuildRequest): * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/retry-failed-build-requests-tests.js: Moved unit tests to test-group-tests.js. * unit-tests/test-groups-tests.js: Added unit tests from 'retry-failed-build-requests-tests.js'. Canonical link: https://commits.webkit.org/238151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 01:23:22 +00:00
for (const testGroup of testGroupsMayNeedMoreRequests) {
const retryCount = await testGroup.scheduleMoreRequestsOrClearFlag(maxRetryFactor);
if (!retryCount)
continue;
const analysisTask = await testGroup.fetchTask();
console.log(`Added ${retryCount} build request(s) to "${testGroup.name()}" of analysis task: ${analysisTask.id()} - "${analysisTask.name()}"`);
}
} catch (error) {
console.error(error);
if (typeof(error.stack) == 'string') {
for (let line of error.stack.split('\n'))
console.error(line);
}
}
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
[perf dashboard] Add sequential mode for perf dashboard A/B testing. https://bugs.webkit.org/show_bug.cgi?id=223886 Reviewed by Ryosuke Niwa. Add 'testgroup_repetition_type' to 'analysis_test_groups' table to store repetition type which defaults to 'alternating'. Add support to schedule 'sequential' A/B testing which schedules all iterations for the first configuration (A) before the iterations for the second configuration (B). Before this patch, all A/B testing alternated between two different configurations for each iteration. Add retry logic for 'sequential' A/B testing. Update syncing script to not proceed with next configuration the current configuration successfully completed more iterations than the initially requested or retries exceeded the list. Fix a potential race in syncing script that 'Promise.all' may cause test group not scheduled in order. * browser-tests/test-group-form-tests.js: Updated and added unit tests. * init-database.sql: Added 'testgroup_repetition_type' field to 'analysis_test_groups' table. * migrate-database.sql: Updated migration script to conditionally add 'testgroup_repetition_type' field. * public/api/test-groups.php: Added 'repetitionType' field in api return value. * public/include/build-requests-fetcher.php: Fetching build requests under a triggerable should include test group with all test groups finished but still need retry. This will allow syncing script to resolve the build request by ID and block other request to be scheduled on the builder. * public/include/commit-sets-helpers.php: Added code to create build requests based on test mode. * public/privileged-api/add-build-requests.php: Added support to only add build requests to one commit set. * public/privileged-api/create-analysis-task.php: Added 'repetitionType' support. * public/privileged-api/create-test-group.php: Added 'repetitionType' support. * public/privileged-api/update-test-group.php: * public/shared/common-component-base.js: * public/v3/components/custom-configuration-test-group-form.js: Added 'repetitionType' support. (CustomConfigurationTestGroupForm.prototype.startTesting): * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): * public/v3/components/test-group-form.js: (TestGroupForm.prototype.startTesting): * public/v3/models/analysis-task.js: (AnalysisTask.async create): (AnalysisTask): * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.updateSingleton): Allow build request order to be updated. * public/v3/models/test-group.js: (TestGroup): (TestGroup.prototype.updateSingleton): (TestGroup.prototype.repetitionType): (TestGroup.prototype.repetitionCountForCommitSet): Refactored `repetitionCount` since repetition may be different between configurations. (TestGroup.prototype.hasRetries): A helper function to tell if a test group has retry runs. (TestGroup.prototype.additionalRepetitionNeededToReachInitialRepetitionCount): (TestGroup.prototype.successfulTestCount): (TestGroup.prototype.isFirstTestRequest): (TestGroup.prototype.precedingBuildRequest): (TestGroup.prototype.retryCountForCommitSet): (TestGroup.prototype.retryCountsAreSameForAllCommitSets): (TestGroup.prototype.async _createAlternatingRetriesForTestGroup): Moved from 'retry-failed-build-requests' module. (TestGroup.async _createSequentialRetriesForTestGroup): Moved from 'retry-failed-build-requests' module. (TestGroup.prototype.async cancelPendingRequests): (TestGroup.prototype.async didSendNotification): (TestGroup.prototype.async addMoreBuildRequests): (TestGroup.async createWithTask): (TestGroup.async createWithCustomConfiguration): (TestGroup.async createAndRefetchTestGroups): (TestGroup.prototype.async scheduleMoreRequestsOrClearFlag): Moved from 'retry-failed-build-requests' module. (TestGroup.async fetchById): Added support to fetch test group by ID. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskConfiguratorPane.prototype.setTestGroups): (AnalysisTaskConfiguratorPane): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype._renderCurrentTestGroup): (AnalysisTaskTestGroupPane.prototype._retrySummary): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.async _retryCurrentTestGroup): (AnalysisTaskPage.prototype.async _bisectCurrentTestGroup): (AnalysisTaskPage.set const): (AnalysisTaskPage.prototype.async _createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype.async _createCustomTestGroup): * public/v3/pages/chart-pane.js: (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async _analyzeRange): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.async _createAnalysisTaskWithGroup): * server-tests/api-build-requests-tests.js: Added a unit test. * server-tests/api-upload-root-tests.js: Updated unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Updated and added unit tests. * server-tests/privileged-api-create-analysis-task-tests.js: Added unit tests. * server-tests/privileged-api-create-test-group-tests.js: Updated and added unit tests. * server-tests/privileged-api-update-test-group-tests.js: Updated and added unit tests. * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/mock-data.js: (MockData.addMockData): (MockData.set addMockBuildRequestsWithRoots): (MockData.set addAnotherMockTestGroup): (MockData.set mockTestSyncConfigWithSingleBuilder): (MockData.sampleBuildData): * server-tests/tools-buildbot-triggerable-tests.js: Updated and added unit tests. * server-tests/tools-sync-buildbot-integration-tests.js: Updated unit tests. (async createTestGroupWithPatch): (createTestGroupWihOwnedCommit): * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): (BuildbotSyncer.prototype.pullBuildbot): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): (BuildbotTriggerable.prototype.async syncOnce): (BuildbotTriggerable.prototype.async _scheduleRequest): (BuildbotTriggerable.prototype._shouldDeferSequentialTestingRequestWithNewCommitSet): * tools/js/measurement-set-analyzer.js: (MeasurementSetAnalyzer.prototype.async _analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/retry-failed-build-requests.js: Removed. * tools/run-analysis.js: Use updated API to retry. (async analysisLoop): (async processTestGroupMayNeedMoreRequests): * tools/sync-buildbot.js: Added command line option '--max-retry-factor'. * unit-tests/analysis-task-tests.js: Updated unit tests. * unit-tests/buildbot-syncer-tests.js: Updated unit tests. (createSampleBuildRequest): * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/retry-failed-build-requests-tests.js: Moved unit tests to test-group-tests.js. * unit-tests/test-groups-tests.js: Added unit tests from 'retry-failed-build-requests-tests.js'. Canonical link: https://commits.webkit.org/238151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 01:23:22 +00:00
try {
const notificationConfig = JSON.parse(fs.readFileSync(options['--notification-config-json'], 'utf-8'));
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
const testGroupsNeedNotification = await TestGroup.fetchAllWithNotificationReady();
const notificationRemoteAPI = new RemoteAPI(notificationConfig.notificationServerConfig);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
const notificationMessageConfig = notificationConfig.notificationMessageConfig;
const notifier = new AnalysisResultsNotifier(notificationMessageConfig.messageTemplate, notificationMessageConfig.finalizeScript,
notificationMessageConfig.messageConstructionRules, notificationRemoteAPI, notificationConfig.notificationServerConfig.path, new Subprocess);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
await notifier.sendNotificationsForTestGroups(testGroupsNeedNotification);
} catch (error) {
[perf dashboard] Add sequential mode for perf dashboard A/B testing. https://bugs.webkit.org/show_bug.cgi?id=223886 Reviewed by Ryosuke Niwa. Add 'testgroup_repetition_type' to 'analysis_test_groups' table to store repetition type which defaults to 'alternating'. Add support to schedule 'sequential' A/B testing which schedules all iterations for the first configuration (A) before the iterations for the second configuration (B). Before this patch, all A/B testing alternated between two different configurations for each iteration. Add retry logic for 'sequential' A/B testing. Update syncing script to not proceed with next configuration the current configuration successfully completed more iterations than the initially requested or retries exceeded the list. Fix a potential race in syncing script that 'Promise.all' may cause test group not scheduled in order. * browser-tests/test-group-form-tests.js: Updated and added unit tests. * init-database.sql: Added 'testgroup_repetition_type' field to 'analysis_test_groups' table. * migrate-database.sql: Updated migration script to conditionally add 'testgroup_repetition_type' field. * public/api/test-groups.php: Added 'repetitionType' field in api return value. * public/include/build-requests-fetcher.php: Fetching build requests under a triggerable should include test group with all test groups finished but still need retry. This will allow syncing script to resolve the build request by ID and block other request to be scheduled on the builder. * public/include/commit-sets-helpers.php: Added code to create build requests based on test mode. * public/privileged-api/add-build-requests.php: Added support to only add build requests to one commit set. * public/privileged-api/create-analysis-task.php: Added 'repetitionType' support. * public/privileged-api/create-test-group.php: Added 'repetitionType' support. * public/privileged-api/update-test-group.php: * public/shared/common-component-base.js: * public/v3/components/custom-configuration-test-group-form.js: Added 'repetitionType' support. (CustomConfigurationTestGroupForm.prototype.startTesting): * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): * public/v3/components/test-group-form.js: (TestGroupForm.prototype.startTesting): * public/v3/models/analysis-task.js: (AnalysisTask.async create): (AnalysisTask): * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.updateSingleton): Allow build request order to be updated. * public/v3/models/test-group.js: (TestGroup): (TestGroup.prototype.updateSingleton): (TestGroup.prototype.repetitionType): (TestGroup.prototype.repetitionCountForCommitSet): Refactored `repetitionCount` since repetition may be different between configurations. (TestGroup.prototype.hasRetries): A helper function to tell if a test group has retry runs. (TestGroup.prototype.additionalRepetitionNeededToReachInitialRepetitionCount): (TestGroup.prototype.successfulTestCount): (TestGroup.prototype.isFirstTestRequest): (TestGroup.prototype.precedingBuildRequest): (TestGroup.prototype.retryCountForCommitSet): (TestGroup.prototype.retryCountsAreSameForAllCommitSets): (TestGroup.prototype.async _createAlternatingRetriesForTestGroup): Moved from 'retry-failed-build-requests' module. (TestGroup.async _createSequentialRetriesForTestGroup): Moved from 'retry-failed-build-requests' module. (TestGroup.prototype.async cancelPendingRequests): (TestGroup.prototype.async didSendNotification): (TestGroup.prototype.async addMoreBuildRequests): (TestGroup.async createWithTask): (TestGroup.async createWithCustomConfiguration): (TestGroup.async createAndRefetchTestGroups): (TestGroup.prototype.async scheduleMoreRequestsOrClearFlag): Moved from 'retry-failed-build-requests' module. (TestGroup.async fetchById): Added support to fetch test group by ID. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskConfiguratorPane.prototype.setTestGroups): (AnalysisTaskConfiguratorPane): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype._renderCurrentTestGroup): (AnalysisTaskTestGroupPane.prototype._retrySummary): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.async _retryCurrentTestGroup): (AnalysisTaskPage.prototype.async _bisectCurrentTestGroup): (AnalysisTaskPage.set const): (AnalysisTaskPage.prototype.async _createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype.async _createCustomTestGroup): * public/v3/pages/chart-pane.js: (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async _analyzeRange): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.async _createAnalysisTaskWithGroup): * server-tests/api-build-requests-tests.js: Added a unit test. * server-tests/api-upload-root-tests.js: Updated unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Updated and added unit tests. * server-tests/privileged-api-create-analysis-task-tests.js: Added unit tests. * server-tests/privileged-api-create-test-group-tests.js: Updated and added unit tests. * server-tests/privileged-api-update-test-group-tests.js: Updated and added unit tests. * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/mock-data.js: (MockData.addMockData): (MockData.set addMockBuildRequestsWithRoots): (MockData.set addAnotherMockTestGroup): (MockData.set mockTestSyncConfigWithSingleBuilder): (MockData.sampleBuildData): * server-tests/tools-buildbot-triggerable-tests.js: Updated and added unit tests. * server-tests/tools-sync-buildbot-integration-tests.js: Updated unit tests. (async createTestGroupWithPatch): (createTestGroupWihOwnedCommit): * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): (BuildbotSyncer.prototype.pullBuildbot): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): (BuildbotTriggerable.prototype.async syncOnce): (BuildbotTriggerable.prototype.async _scheduleRequest): (BuildbotTriggerable.prototype._shouldDeferSequentialTestingRequestWithNewCommitSet): * tools/js/measurement-set-analyzer.js: (MeasurementSetAnalyzer.prototype.async _analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/retry-failed-build-requests.js: Removed. * tools/run-analysis.js: Use updated API to retry. (async analysisLoop): (async processTestGroupMayNeedMoreRequests): * tools/sync-buildbot.js: Added command line option '--max-retry-factor'. * unit-tests/analysis-task-tests.js: Updated unit tests. * unit-tests/buildbot-syncer-tests.js: Updated unit tests. (createSampleBuildRequest): * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/retry-failed-build-requests-tests.js: Moved unit tests to test-group-tests.js. * unit-tests/test-groups-tests.js: Added unit tests from 'retry-failed-build-requests-tests.js'. Canonical link: https://commits.webkit.org/238151@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 01:23:22 +00:00
console.error(`Failed to send notification for test groups due to ${error}`);
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
}
console.log(`Sleeping for ${secondsToSleep} seconds.`);
setTimeout(() => analysisLoop(options), secondsToSleep * 1000);
}
main(process.argv);