Diff
Modified: trunk/Tools/ChangeLog (265304 => 265305)
--- trunk/Tools/ChangeLog 2020-08-05 21:08:05 UTC (rev 265304)
+++ trunk/Tools/ChangeLog 2020-08-05 21:12:27 UTC (rev 265305)
@@ -1,3 +1,21 @@
+2020-08-05 Jonathan Bedard <jbed...@apple.com>
+
+ results.webkit.org: Return worker status to caller
+ https://bugs.webkit.org/show_bug.cgi?id=215086
+ <rdar://problem/66476525>
+
+ Rubber-stamped by Aakash Jain.
+
+ * resultsdbpy/resultsdbpy/model/model.py:
+ (Model.do_work): Return if process has successfully processed results.
+ * resultsdbpy/resultsdbpy/model/model_unittest.py:
+ (ModelTest.test_no_work):
+ * resultsdbpy/resultsdbpy/model/upload_context.py:
+ (UploadContext._do_job_for_key): Return if the job was successful.
+ (UploadContext.do_processing_work): Return true if any processed jobs were successful.
+ * resultsdbpy/resultsdbpy/model/upload_context_unittest.py:
+ (UploadContextTest.test_async_callback):
+
2020-08-05 Beth Dakin <bda...@apple.com>
Make report-non-inclusive-language ignore files within .svn and .git
Modified: trunk/Tools/resultsdbpy/resultsdbpy/model/model.py (265304 => 265305)
--- trunk/Tools/resultsdbpy/resultsdbpy/model/model.py 2020-08-05 21:08:05 UTC (rev 265304)
+++ trunk/Tools/resultsdbpy/resultsdbpy/model/model.py 2020-08-05 21:12:27 UTC (rev 265305)
@@ -128,7 +128,9 @@
raise RuntimeError('No work to be done, asynchronous processing disabled')
try:
- self.upload_context.do_processing_work()
+ return self.upload_context.do_processing_work()
except Exception as e:
sys.stderr.write(f'{traceback.format_exc()}\n')
sys.stderr.write(f'{e}\n')
+
+ return False
Modified: trunk/Tools/resultsdbpy/resultsdbpy/model/model_unittest.py (265304 => 265305)
--- trunk/Tools/resultsdbpy/resultsdbpy/model/model_unittest.py 2020-08-05 21:08:05 UTC (rev 265304)
+++ trunk/Tools/resultsdbpy/resultsdbpy/model/model_unittest.py 2020-08-05 21:12:27 UTC (rev 265305)
@@ -43,3 +43,8 @@
self.init_database(redis=redis, cassandra=cassandra)
self.assertTrue(self.model.healthy())
self.assertTrue(self.model.healthy(writable=False))
+
+ @WaitForDockerTestCase.mock_if_no_docker(mock_redis=FakeStrictRedis, mock_cassandra=MockCassandraContext)
+ def test_no_work(self, redis=StrictRedis, cassandra=CassandraContext):
+ self.init_database(redis=redis, cassandra=cassandra, async_processing=True)
+ self.assertFalse(self.model.do_work())
Modified: trunk/Tools/resultsdbpy/resultsdbpy/model/upload_context.py (265304 => 265305)
--- trunk/Tools/resultsdbpy/resultsdbpy/model/upload_context.py 2020-08-05 21:08:05 UTC (rev 265304)
+++ trunk/Tools/resultsdbpy/resultsdbpy/model/upload_context.py 2020-08-05 21:12:27 UTC (rev 265305)
@@ -195,18 +195,22 @@
json.dumps(dict(started_processing=0, attempts=attempts)),
ex=self.PROCESS_TIMEOUT,
)
+ return job_complete
def do_processing_work(self):
jobs_left = True
+ did_complete = False
while jobs_left:
jobs_left, key, attempts = self._find_job_with_attempts()
if key:
- self._do_job_for_key(key, attempts=attempts)
+ did_complete |= self._do_job_for_key(key, attempts=attempts)
elif jobs_left:
time.sleep(10) # There are jobs, but other workers are processing them.
+ return did_complete
+
def process_test_results(self, configuration, commits, suite, test_results, timestamp=None):
timestamp = timestamp or time.time()
Modified: trunk/Tools/resultsdbpy/resultsdbpy/model/upload_context_unittest.py (265304 => 265305)
--- trunk/Tools/resultsdbpy/resultsdbpy/model/upload_context_unittest.py 2020-08-05 21:08:05 UTC (rev 265304)
+++ trunk/Tools/resultsdbpy/resultsdbpy/model/upload_context_unittest.py 2020-08-05 21:12:27 UTC (rev 265305)
@@ -148,12 +148,12 @@
self.assertEqual(1, len(self.model.suite_context.find_by_commit(configurations=[Configuration()], suite='layout-tests')))
@WaitForDockerTestCase.mock_if_no_docker(mock_redis=FakeStrictRedis, mock_cassandra=MockCassandraContext)
- def _test_async_callback(self, redis=StrictRedis, cassandra=CassandraContext):
+ def test_async_callback(self, redis=StrictRedis, cassandra=CassandraContext):
self.init_database(redis=redis, cassandra=cassandra, async_processing=True)
MockModelFactory.add_mock_results(self.model)
configuration_to_search = Configuration(platform='iOS', version='12.0.0', is_simulator=True, style='Asan')
- configuration, uploads = self.model.upload_context.find_test_results(configurations=[configuration_to_search], suite='layout-tests', recent=False).items()[0]
+ configuration, uploads = next(iter(self.model.upload_context.find_test_results(configurations=[configuration_to_search], suite='layout-tests', recent=False).items()))
self.model.upload_context.process_test_results(
configuration=configuration,
commits=uploads[0]['commits'],
@@ -164,5 +164,5 @@
# Using suite results as a proxy to tell if callbacks were triggered
self.assertEqual(0, len(self.model.suite_context.find_by_commit(configurations=[Configuration()], suite='layout-tests')))
- self.model.upload_context.do_processing_work()
+ self.assertTrue(self.model.upload_context.do_processing_work())
self.assertEqual(1, len(self.model.suite_context.find_by_commit(configurations=[Configuration()], suite='layout-tests')))