Increase parallel emerge job output interval

Building chromeos-chrome might occasionally take more than 2 hours
and trying to print the output the second time seems to cause problems
on Chrome PFQ (build packages get stuck for hours, eventually timing out
the build).

This increases the interval as which output is printed to avoid
printing continued output in attempt to unblock Chrome PFQ (assuming my
hunch about the cause is correct).

BUG=chromium:988364
TEST=run_tests

Change-Id: Ibd7e22389e32defc83e8c08b60611f7405f50f25
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1730842
Tested-by: Toni Baržić <tbarzic@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/scripts/parallel_emerge.py b/scripts/parallel_emerge.py
index 0740bca..639456c 100644
--- a/scripts/parallel_emerge.py
+++ b/scripts/parallel_emerge.py
@@ -1598,14 +1598,23 @@
     # full output for jobs that have been running for 60 minutes or more.
     if self._show_output:
       interval = 60
+      long_interval_multiplier = 1
       notify_interval = 0
     else:
       interval = 60 * 60
+      long_interval_multiplier = 3
       notify_interval = 60 * 2
     for job in self._build_jobs.values():
       if job:
         last_timestamp = max(job.start_timestamp, job.last_output_timestamp)
-        if last_timestamp + interval < current_time:
+        # The chromeos-base/chromeos-chrome package is expected to take
+        # exceptionally long time, so increase the interval for that package to
+        # 180 minutes.
+        interval_multiplier = (
+            long_interval_multiplier
+            if job.pkgname.startswith('chromeos-chrome-')
+            else 1)
+        if last_timestamp + interval * interval_multiplier < current_time:
           self._print_queue.put(JobPrinter(job))
           job.last_output_timestamp = current_time
           no_output = False