Title: [268880] trunk/Tools
Revision
268880
Author
[email protected]
Date
2020-10-22 11:51:09 -0700 (Thu, 22 Oct 2020)

Log Message

[webkitpy] Rename slave to worker in perftestsrunner
https://bugs.webkit.org/show_bug.cgi?id=218082

Reviewed by Ryosuke Niwa.

* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner._parse_args): Supporting both --slave-config-json-path and --worker-config-json-path for now.
(_generate_results):
(_merge_worker_config_json):
(_merge_slave_config_json): Deleted.
* Scripts/webkitpy/performance_tests/perftestsrunner_integrationtest.py:
* Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:
(MainTest.test_parse_args):
(MainTest.test_parse_deprecated_args): Added unit-test for deprecated parameter.
* BuildSlaveSupport/build.webkit.org-config/steps.py:
(RunAndUploadPerfTests):

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py (268879 => 268880)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py	2020-10-22 18:47:56 UTC (rev 268879)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py	2020-10-22 18:51:09 UTC (rev 268880)
@@ -937,7 +937,7 @@
     descriptionDone = ["perf-tests"]
     command = ["python", "./Tools/Scripts/run-perf-tests",
                "--output-json-path", "perf-test-results.json",
-               "--slave-config-json-path", "../../perf-test-config.json",
+               "--worker-config-json-path", "../../perf-test-config.json",
                "--no-show-results",
                "--reset-results",
                "--test-results-server", "perf.webkit.org",

Modified: trunk/Tools/ChangeLog (268879 => 268880)


--- trunk/Tools/ChangeLog	2020-10-22 18:47:56 UTC (rev 268879)
+++ trunk/Tools/ChangeLog	2020-10-22 18:51:09 UTC (rev 268880)
@@ -1,3 +1,22 @@
+2020-10-22  Aakash Jain  <[email protected]>
+
+        [webkitpy] Rename slave to worker in perftestsrunner
+        https://bugs.webkit.org/show_bug.cgi?id=218082
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (PerfTestsRunner._parse_args): Supporting both --slave-config-json-path and --worker-config-json-path for now.
+        (_generate_results):
+        (_merge_worker_config_json):
+        (_merge_slave_config_json): Deleted.
+        * Scripts/webkitpy/performance_tests/perftestsrunner_integrationtest.py:
+        * Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:
+        (MainTest.test_parse_args):
+        (MainTest.test_parse_deprecated_args): Added unit-test for deprecated parameter.
+        * BuildSlaveSupport/build.webkit.org-config/steps.py:
+        (RunAndUploadPerfTests):
+
 2020-10-22  Jonathan Bedard  <[email protected]>
 
         Few webkitpy tests fail for machines in non-PST timezones

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py (268879 => 268880)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py	2020-10-22 18:47:56 UTC (rev 268879)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py	2020-10-22 18:51:09 UTC (rev 268880)
@@ -111,8 +111,9 @@
                 help="Path to generate a JSON file at; may contain previous results if it already exists."),
             optparse.make_option("--reset-results", action=""
                 help="Clears the content in the generated JSON file before adding the results."),
-            optparse.make_option("--slave-config-json-path", action='', callback=_expand_path, type="str",
-                help="Only used on bots. Path to a slave configuration file."),
+            optparse.make_option("--slave-config-json-path", "--worker-config-json-path", action='',
+                callback=_expand_path, type="str", dest="worker_config_json_path",
+                help="Only used on bots. Path to a worker configuration file."),
             optparse.make_option("--description",
                 help="Add a description to the output JSON file if one is generated"),
             optparse.make_option("--no-show-results", action="" default=True, dest="show_results",
@@ -246,8 +247,8 @@
         output_json_path = self._output_json_path()
         output = self._generate_results_dict(self._timestamp, options.description, options.platform, options.builder_name, options.build_number)
 
-        if options.slave_config_json_path:
-            output = self._merge_slave_config_json(options.slave_config_json_path, output)
+        if options.worker_config_json_path:
+            output = self._merge_worker_config_json(options.worker_config_json_path, output)
             if not output:
                 return self.EXIT_CODE_BAD_SOURCE_JSON
 
@@ -316,19 +317,19 @@
     def _datetime_in_ES5_compatible_iso_format(datetime):
         return datetime.strftime('%Y-%m-%dT%H:%M:%S.%f')
 
-    def _merge_slave_config_json(self, slave_config_json_path, contents):
-        if not self._host.filesystem.isfile(slave_config_json_path):
-            _log.error("Missing slave configuration JSON file: %s" % slave_config_json_path)
+    def _merge_worker_config_json(self, worker_config_json_path, contents):
+        if not self._host.filesystem.isfile(worker_config_json_path):
+            _log.error('Missing worker configuration JSON file: {}'.format(worker_config_json_path))
             return None
 
         try:
-            slave_config_json = self._host.filesystem.open_text_file_for_reading(slave_config_json_path)
-            slave_config = json.load(slave_config_json)
-            for key in slave_config:
-                contents['builder' + key.capitalize()] = slave_config[key]
+            worker_config_json = self._host.filesystem.open_text_file_for_reading(worker_config_json_path)
+            worker_config = json.load(worker_config_json)
+            for key in worker_config:
+                contents['builder' + key.capitalize()] = worker_config[key]
             return contents
         except Exception as error:
-            _log.error("Failed to merge slave configuration JSON file %s: %s" % (slave_config_json_path, error))
+            _log.error('Failed to merge worker configuration JSON file {}: {}'.format(worker_config_json_path, error))
         return None
 
     def _merge_outputs_if_needed(self, output_json_path, output):

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_integrationtest.py (268879 => 268880)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_integrationtest.py	2020-10-22 18:47:56 UTC (rev 268879)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_integrationtest.py	2020-10-22 18:51:09 UTC (rev 268880)
@@ -446,23 +446,23 @@
         port.host.filesystem.write_text_file('/mock-checkout/output.json', '{"another bad json": "1"}')
         self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_MERGE)
 
-    def test_run_with_slave_config_json(self):
+    def test_run_with_worker_config_json(self):
         runner, port = self.create_runner_and_setup_results_template(args=['--output-json-path=/mock-checkout/output.json',
-            '--slave-config-json-path=/mock-checkout/slave-config.json', '--test-results-server=some.host'])
-        port.host.filesystem.write_text_file('/mock-checkout/slave-config.json', '{"key": "value"}')
+            '--worker-config-json-path=/mock-checkout/worker-config.json', '--test-results-server=some.host'])
+        port.host.filesystem.write_text_file('/mock-checkout/worker-config.json', '{"key": "value"}')
         self._test_run_with_json_output(runner, port.host.filesystem, upload_succeeds=True)
         self.assertEqual(self._load_output_json(runner), [{
             "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_target_wrapper_and_inspector_results,
             "revisions": {"WebKit": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}, "builderKey": "value"}])
 
-    def test_run_with_bad_slave_config_json(self):
+    def test_run_with_bad_worker_config_json(self):
         runner, port = self.create_runner_and_setup_results_template(args=['--output-json-path=/mock-checkout/output.json',
-            '--slave-config-json-path=/mock-checkout/slave-config.json', '--test-results-server=some.host'])
+            '--worker-config-json-path=/mock-checkout/worker-config.json', '--test-results-server=some.host'])
         logs = self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_SOURCE_JSON)
-        self.assertTrue('Missing slave configuration JSON file: /mock-checkout/slave-config.json' in logs)
-        port.host.filesystem.write_text_file('/mock-checkout/slave-config.json', 'bad json')
+        self.assertTrue('Missing worker configuration JSON file: /mock-checkout/worker-config.json' in logs)
+        port.host.filesystem.write_text_file('/mock-checkout/worker-config.json', 'bad json')
         self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_SOURCE_JSON)
-        port.host.filesystem.write_text_file('/mock-checkout/slave-config.json', '["another bad json"]')
+        port.host.filesystem.write_text_file('/mock-checkout/worker-config.json', '["another bad json"]')
         self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_SOURCE_JSON)
 
     def test_run_with_multiple_repositories(self):
@@ -490,8 +490,8 @@
     def test_run_with_upload_json_should_generate_perf_webkit_json(self):
         runner, port = self.create_runner_and_setup_results_template(args=['--output-json-path=/mock-checkout/output.json',
             '--test-results-server', 'some.host', '--platform', 'platform1', '--builder-name', 'builder1', '--build-number', '123',
-            '--slave-config-json-path=/mock-checkout/slave-config.json'])
-        port.host.filesystem.write_text_file('/mock-checkout/slave-config.json', '{"key": "value1"}')
+            '--worker-config-json-path=/mock-checkout/worker-config.json'])
+        port.host.filesystem.write_text_file('/mock-checkout/worker-config.json', '{"key": "value1"}')
 
         self._test_run_with_json_output(runner, port.host.filesystem, upload_succeeds=True)
         generated_json = json.loads(port.host.filesystem.files['/mock-checkout/output.json'])

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py (268879 => 268880)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py	2020-10-22 18:47:56 UTC (rev 268879)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py	2020-10-22 18:51:09 UTC (rev 268880)
@@ -149,7 +149,7 @@
                 '--no-show-results',
                 '--reset-results',
                 '--output-json-path=a/output.json',
-                '--slave-config-json-path=a/source.json',
+                '--worker-config-json-path=a/source.json',
                 '--test-results-server=somehost',
                 '--additional-drt-flag=--enable-threaded-parser',
                 '--additional-drt-flag=--awesomesauce',
@@ -167,7 +167,7 @@
         self.assertFalse(options.show_results)
         self.assertTrue(options.reset_results)
         self.assertEqual(options.output_json_path, 'a/output.json')
-        self.assertEqual(options.slave_config_json_path, 'a/source.json')
+        self.assertEqual(options.worker_config_json_path, 'a/source.json')
         self.assertEqual(options.test_results_server, 'somehost')
         self.assertEqual(options.additional_drt_flag, ['--enable-threaded-parser', '--awesomesauce'])
         self.assertEqual(options.repeat, 5)
@@ -174,6 +174,11 @@
         self.assertEqual(options.test_runner_count, 5)
         self.assertEqual(options.no_timeout, True)
 
+    def test_parse_deprecated_args(self):
+        # FIXME: remove this test and the corresponding parameter after all instances of this deprecated parameter have been removed
+        options, _ = PerfTestsRunner._parse_args(['--slave-config-json-path=a/source1.json'])
+        self.assertEqual(options.worker_config_json_path, 'a/source1.json')
+
     def test_upload_json(self):
         runner, port = self.create_runner()
         port.host.filesystem.files['/mock-checkout/some.json'] = 'some content'
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to