Changeset 190900 in webkit
- Timestamp:
- Oct 12, 2015, 4:05:43 PM (10 years ago)
- Location:
- trunk/Websites/perf.webkit.org
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
tools/detect-changes.js (modified) (2 diffs)
-
tools/pull-os-versions.py (modified) (2 diffs)
-
tools/pull-svn.py (modified) (3 diffs)
-
tools/sync-with-buildbot.py (modified) (3 diffs)
-
tools/util.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/perf.webkit.org/ChangeLog
r190898 r190900 1 2015-10-12 Ryosuke Niwa <rniwa@webkit.org> 2 3 Perf dashboard tools shouldn't require server credentials in multiple configuration files 4 https://bugs.webkit.org/show_bug.cgi?id=149994 5 6 Reviewed by Chris Dumez. 7 8 Made detect-changes.js and pull-svn.py pull username and passwords from the server config JSON to reduce 9 the number of JSON files that need to include credentials. 10 11 Also made each script reload the server config after sleep to allow dynamic credential updates. 12 13 In addition, change the server config JSON's format to include scheme, host, and port numbers separately 14 instead of a url since detect-changes.js needs each value separately. 15 16 This reduces the number of JSONs with credentials to two for our internal dashboard. 17 18 * tools/detect-changes.js: 19 (main): Added a property argument parsing. Now takes --server-config-json, --change-detection-config-json, 20 and --seconds-to-sleep like other scripts. 21 (parseArgument): Added. 22 (fetchManifestAndAnalyzeData): Reload the server config JSON. 23 (loadServerConfig): Added. Set settings.perfserver and settings.slave from the server config JSON. Also 24 add settings.perfserver.host to match the old format. 25 (configurationsForTesting): Fixed a bug that we throw an exception when a dashboard contains an empty cell. 26 27 * tools/pull-os-versions.py: 28 (main): Use load_server_config after each sleep. 29 30 * tools/pull-svn.py: 31 (main): Use load_server_config after each sleep. 32 (fetch_commits_and_submit): Use the perf dashboard's auth as subversion credential when useServerAuth is set. 33 34 * tools/sync-with-buildbot.py: 35 (main): Use load_server_config after each sleep. 36 37 * tools/util.py: 38 (load_server_config): Extracted from python scripts. Computes server's url from scheme, host, and port number 39 to match the old format python scripts except. 40 1 41 2015-10-11 Ryosuke Niwa <rniwa@webkit.org> 2 42 -
trunk/Websites/perf.webkit.org/tools/detect-changes.js
r183232 r190900 8 8 var Statistics = require('../public/v2/js/statistics.js'); 9 9 10 // FIXME: We shouldn't use a global variable like this. 10 11 var settings; 11 12 function main(argv) 12 13 { 13 if (argv.length < 3) { 14 console.error('Please specify the settings JSON path'); 15 return 1; 16 } 17 18 settings = JSON.parse(fs.readFileSync(argv[2], 'utf8')); 19 20 fetchManifestAndAnalyzeData(); 21 } 22 23 function fetchManifestAndAnalyzeData() 24 { 14 var options = parseArgument(argv, [ 15 {name: '--server-config-json', required: true}, 16 {name: '--change-detection-config-json', required: true}, 17 {name: '--seconds-to-sleep', type: parseFloat, default: 1200}, 18 ]); 19 if (!options) 20 return; 21 22 settings = JSON.parse(fs.readFileSync(options['--change-detection-config-json'], 'utf8')); 23 settings.secondsToSleep = options['--seconds-to-sleep']; 24 25 fetchManifestAndAnalyzeData(options['--server-config-json']); 26 } 27 28 function parseArgument(argv, acceptedOptions) { 29 var args = argv.slice(2); 30 var options = {} 31 for (var i = 0; i < args.length; i += 2) { 32 var current = args[i]; 33 var next = args[i + 1]; 34 for (var option of acceptedOptions) { 35 if (current == option['name']) { 36 options[option['name']] = next; 37 next = null; 38 break; 39 } 40 } 41 if (next) { 42 console.error('Invalid argument:', current); 43 return null; 44 } 45 } 46 for (var option of acceptedOptions) { 47 var name = option['name']; 48 if (option['required'] && !(name in options)) { 49 console.log('Required argument', name, 'is missing'); 50 return null; 51 } 52 var value = options[name] || option['default']; 53 var converter = option['type']; 54 options[name] = converter ? converter(value) : value; 55 } 56 return options; 57 } 58 59 function fetchManifestAndAnalyzeData(serverConfigJSON) 60 { 61 loadServerConfig(serverConfigJSON); 62 25 63 getJSON(settings.perfserver, '/data/manifest.json').then(function (manifest) { 26 64 return mapInOrder(configurationsForTesting(manifest), analyzeConfiguration); 27 65 }).catch(function (reason) { 28 console.error('Failed to obtain the manifest file' );66 console.error('Failed to obtain the manifest file', reason); 29 67 }).then(function () { 30 68 console.log(''); 31 69 console.log('Sleeing for', settings.secondsToSleep, 'seconds'); 32 setTimeout(fetchManifestAndAnalyzeData, settings.secondsToSleep * 1000); 33 }); 70 setTimeout(function () { 71 fetchManifestAndAnalyzeData(serverConfigJSON); 72 }, settings.secondsToSleep * 1000); 73 }); 74 } 75 76 function loadServerConfig(serverConfigJSON) 77 { 78 var serverConfig = JSON.parse(fs.readFileSync(serverConfigJSON, 'utf8')); 79 80 var server = serverConfig['server']; 81 if ('auth' in server) 82 server['auth'] = server['auth']['username'] + ':' + server['auth']['password']; 83 84 settings.perfserver = server; 85 settings.slave = serverConfig['slave']; 34 86 } 35 87 … … 55 107 for (var row of dashboard) { 56 108 for (var cell of row) { 57 if (cell instanceof Array) 58 configurations.push({platformId: parseInt(cell[0]), metricId: parseInt(cell[1])}); 109 if (cell instanceof Array) { 110 var platformId = parseInt(cell[0]); 111 var metricId = parseInt(cell[1]); 112 if (!isNaN(platformId) && !isNaN(metricId)) 113 configurations.push({platformId: platformId, metricId: metricId}); 114 } 59 115 } 60 116 } -
trunk/Websites/perf.webkit.org/tools/pull-os-versions.py
r190817 r190900 15 15 from util import submit_commits 16 16 from util import text_content 17 from util import setup_auth17 from util import load_server_config 18 18 19 19 … … 28 28 os_config_list = json.load(os_config_json) 29 29 30 with open(args.server_config_json) as server_config_json:31 server_config = json.load(server_config_json)32 setup_auth(server_config['server'])33 34 30 fetchers = [OSBuildFetcher(os_config) for os_config in os_config_list] 35 31 36 32 while True: 33 server_config = load_server_config(args.server_config_json) 37 34 for fetcher in fetchers: 38 35 fetcher.fetch_and_report_new_builds(server_config) -
trunk/Websites/perf.webkit.org/tools/pull-svn.py
r190764 r190900 10 10 11 11 from xml.dom.minidom import parseString as parseXmlString 12 from util import setup_auth12 from util import load_server_config 13 13 from util import submit_commits 14 14 from util import text_content … … 23 23 args = parser.parse_args() 24 24 25 with open(args.server_config_json) as server_config_json:26 server_config = json.load(server_config_json)27 setup_auth(server_config['server'])28 29 25 with open(args.svn_config_json) as svn_config_json: 30 26 svn_config = json.load(svn_config_json) 31 27 32 28 while True: 29 server_config = load_server_config(args.server_config_json) 33 30 for repository_info in svn_config: 34 31 fetch_commits_and_submit(repository_info, server_config, args.max_fetch_count) … … 44 41 print "Determining the stating revision for %s" % repository['name'] 45 42 repository['revisionToFecth'] = determine_first_revision_to_fetch(server_config['server']['url'], repository['name']) 43 44 if 'useServerAuth' in repository: 45 repository['username'] = server_config['server']['auth']['username'] 46 repository['password'] = server_config['server']['auth']['password'] 46 47 47 48 pending_commits = [] -
trunk/Websites/perf.webkit.org/tools/sync-with-buildbot.py
r186033 r190900 10 10 import urllib2 11 11 12 from util import setup_auth12 from util import load_server_config 13 13 14 14 … … 28 28 configurations = load_config(args.builder_config_json, args.buildbot_url.strip('/')) 29 29 30 with open(args.server_config_json) as server_config_json:31 server_config = json.load(server_config_json)32 setup_auth(server_config['server'])33 34 build_requests_url = server_config['server']['url'] + '/api/build-requests/' + args.triggerable35 36 30 request_updates = {} 37 31 while True: 32 server_config = load_server_config(args.server_config_json) 38 33 request_updates.update(find_request_updates(configurations, args.lookback_count)) 39 34 if request_updates: … … 46 41 'slaveName': server_config['slave']['name'], 47 42 'slavePassword': server_config['slave']['password']} 43 44 build_requests_url = server_config['server']['url'] + '/api/build-requests/' + args.triggerable 48 45 response = update_and_fetch_build_requests(build_requests_url, payload) 49 46 open_requests = response.get('buildRequests', []) -
trunk/Websites/perf.webkit.org/tools/util.py
r186033 r190900 52 52 auth_handler = HTTP_AUTH_HANDLERS[auth['type']](password_manager) 53 53 urllib2.install_opener(urllib2.build_opener(auth_handler)) 54 55 56 def load_server_config(json_path): 57 with open(json_path) as server_config_json: 58 server_config = json.load(server_config_json) 59 server = server_config['server'] 60 server['url'] = server['scheme'] + '://' + server['host'] + ':' + str(server['port']) 61 setup_auth(server) 62 return server_config
Note:
See TracChangeset
for help on using the changeset viewer.