0

fast_local_dev_server.py: Show no message when no jobs are pending

And tweak the message:

  Old: "Build Server Status: [24/24]"
  New: "There are still 2 static analysis jobs running in the background."

Change-Id: I06ee519e0db863f51718b3364c290e47ab32b763
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6377824
Reviewed-by: Mohamed Heikal <mheikal@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1435561}
This commit is contained in:
Andrew Grieve
2025-03-20 11:13:06 -07:00
committed by Chromium LUCI CQ
parent 98bc378d7f
commit 2f123a0291
2 changed files with 13 additions and 11 deletions

@ -1006,7 +1006,7 @@ def _print_build_status_all():
status += f' in {out_dir}'
status += f'. Completed [{completed_tasks}/{total_tasks}].'
if completed_tasks < total_tasks:
status += f' {len(active_tasks)} tasks currently executing'
status += f' {len(active_tasks)} task(s) currently executing'
print(f'{build_id}: {status}')
if all_active_tasks:
total = len(all_active_tasks)
@ -1034,14 +1034,14 @@ def _print_build_status(build_id):
print('⚠️ No server running. Consult $OUTDIR/buildserver.log.0')
return 0
pending_tasks = build_info['pending_tasks']
completed_tasks = build_info['completed_tasks']
total_tasks = pending_tasks + completed_tasks
# Print nothing if we never got any tasks.
if completed_tasks:
print(f'⏩ Build Server Status: [{completed_tasks}/{total_tasks}]')
if pending_tasks:
print('⏩ To wait for jobs:', shlex.join([server_path, '--wait-for-idle']))
# Print nothing unless there are still pending tasks
if pending_tasks:
is_str = 'is' if pending_tasks == 1 else 'are'
job_str = 'job' if pending_tasks == 1 else 'jobs'
print(f'⏩ There {is_str} still {pending_tasks} static analysis {job_str}'
' running in the background.')
print('⏩ To wait for them:', shlex.join([server_path, '--wait-for-idle']))
return 0

@ -233,7 +233,7 @@ class ServerStartedTest(unittest.TestCase):
self.waitForTasksDone()
proc_result = callServer(['--print-status', self._build_id])
self.assertIn('[1/1]', proc_result.stdout)
self.assertEqual('', proc_result.stdout)
proc_result = callServer(['--print-status-all'])
self.assertIn('has 1 registered build', proc_result.stdout)
@ -243,14 +243,16 @@ class ServerStartedTest(unittest.TestCase):
# cat gets stuck until we open the other end of the fifo.
self.sendTask(['cat', str(fifo_path)])
proc_result = callServer(['--print-status', self._build_id])
self.assertIn('[1/2]', proc_result.stdout)
self.assertIn('is still 1 static analysis job', proc_result.stdout)
self.assertIn('--wait-for-idle', proc_result.stdout)
proc_result = callServer(['--print-status-all'])
self.assertIn('[1/2]', proc_result.stdout)
self.waitForTasksDone()
callServer(['--cancel-build', self._build_id])
self.waitForTasksDone()
proc_result = callServer(['--print-status', self._build_id])
self.assertIn('[2/2]', proc_result.stdout)
self.assertEqual('', proc_result.stdout)
proc_result = callServer(['--print-status-all'])
self.assertIn('Siso finished', proc_result.stdout)