Closed Bug 1143013 Opened 9 years ago Closed 9 years ago

Ensure b2g_build passes number of cores to commands to workaround any previous -j settings...

Categories

(Release Engineering :: Applications: MozharnessCore, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jlal, Unassigned)

Details

Attachments

(2 files, 1 obsolete file)

I found some issues while debugging performance in taskcluster that revealed -j was set in .userconfig after running some commands and -j could happen to be 1 (due to some of the conditionals) once this is set and cached the b2g build system will not attempt to detect cores and your stuck building with 1 core. The workaround is to pass -j every time.
Attachment #8577273 - Flags: review?(catlee)
Attachment #8577273 - Attachment is patch: true
Attachment #8577273 - Flags: review?(catlee) → review+
https://hg.mozilla.org/build/mozharness/rev/bc2b3ab7c9c6
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
This busted things:
11:56:20     INFO - Running pre-action listener: influxdb_recording_pre_action
11:56:20     INFO - Running main action method: build
11:56:20     INFO - Running post-action listener: influxdb_recording_post_action
11:56:20    FATAL - Uncaught exception: Traceback (most recent call last):
11:56:20    FATAL -   File "/tools/checkouts/mozharness/mozharness/base/script.py", line 1278, in run
11:56:20    FATAL -     self.run_action(action)
11:56:20    FATAL -   File "/tools/checkouts/mozharness/mozharness/base/script.py", line 1220, in run_action
11:56:20    FATAL -     self._possibly_run_method(method_name, error_if_missing=True)
11:56:20    FATAL -   File "/tools/checkouts/mozharness/mozharness/base/script.py", line 1161, in _possibly_run_method
11:56:20    FATAL -     return getattr(self, method_name)()
11:56:20    FATAL -   File "/tools/checkouts/mozharness/scripts/b2g_build.py", line 564, in build
11:56:20    FATAL -     cmds = [self.generate_build_command(t) for t in build_targets]
11:56:20    FATAL -   File "/tools/checkouts/mozharness/scripts/b2g_build.py", line 553, in generate_build_command
11:56:20    FATAL -     cmd.append('-j{}'.format(multiprocessing.cpu_count()))
11:56:20    FATAL - ValueError: zero length field name in format

I backed it out because it wasn't obvious to be me what the fix was, and the tree was burning.
r? to bhearsum who tested this on the builders for me (thanks !!!!)
Attachment #8577422 - Flags: review?(bhearsum)
Comment on attachment 8577422 [details]
Attempt #2 which should work on python2.6

 import sys
 import os
 import glob
 import re
 import tempfile
 from datetime import datetime
 import urlparse
+import multiprocessing
 import xml.dom.minidom
 
 try:
     import simplejson as json
     assert json
 except ImportError:
     import json
 
@@ -540,16 +541,21 @@
         self.run_command(["diff", "-u", sourcesfile_orig, sourcesfile], success_codes=[1])
 
     def generate_build_command(self, target=None):
         cmd = ['./build.sh']
         if target is not None:
             # Workaround bug 984061
             if target == 'package-tests':
                 cmd.append('-j1')
+            else:
+                # Ensure we always utilize the correct number of cores
+                # regardless of the configuration which may be set by repo
+                # config changes...
+                cmd.append('-j{0}'.format(multiprocessing.cpu_count()))
             cmd.append(target)
         return cmd
 
     def build(self):
         dirs = self.query_abs_dirs()
         gecko_config = self.load_gecko_config()
         build_targets = gecko_config.get('build_targets', [])
         if not build_targets:
Attachment #8577422 - Attachment is obsolete: true
Attachment #8577422 - Flags: review?(bhearsum)
Attachment #8577425 - Flags: review?(bhearsum)
Attachment #8577425 - Flags: review?(bhearsum) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: