Bug 1409046 - Prevent re-creating virtualenv everytime ./mach talos is run. r=rwood
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 10 Jan 2018 01:59:53 -0800
changeset 452896 f46f4e29d4a083d5e4ed9b0e1fe6669d6e275a9a
parent 452895 df5c4759691588a85ab2017d3e226fafa417bb68
child 452897 88e1c3fbec11c4cfe1ffb5b11cb4882da18e3a54
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrwood
bugs1409046
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1409046 - Prevent re-creating virtualenv everytime ./mach talos is run. r=rwood MozReview-Commit-ID: CsspY1DIS4t
testing/mozharness/mozharness/mozilla/testing/talos.py
testing/talos/mach_commands.py
--- a/testing/mozharness/mozharness/mozilla/testing/talos.py
+++ b/testing/mozharness/mozharness/mozilla/testing/talos.py
@@ -402,26 +402,29 @@ class Talos(TestingMixin, MercurialScrip
 
         # now that have the suite name, check if pageset is required, if so download it
         # the --no-download option will override this
         if self.query_pagesets_name():
             if '--no-download' not in self.config.get('talos_extra_options', []):
                 self.info("Downloading pageset with tooltool...")
                 self.src_talos_webdir = os.path.join(self.talos_path, 'talos')
                 src_talos_pageset = os.path.join(self.src_talos_webdir, 'tests')
-                manifest_file = os.path.join(self.talos_path, 'tp5n-pageset.manifest')
-                self.tooltool_fetch(
-                    manifest_file,
-                    output_dir=src_talos_pageset,
-                    cache=self.config.get('tooltool_cache')
-                )
-                archive = os.path.join(src_talos_pageset, self.pagesets_name)
-                unzip = self.query_exe('unzip')
-                unzip_cmd = [unzip, '-q', '-o', archive, '-d', src_talos_pageset]
-                self.run_command(unzip_cmd, halt_on_failure=True)
+                if not os.path.exists(os.path.join(src_talos_pageset, self.pagesets_name)):
+                    manifest_file = os.path.join(self.talos_path, 'tp5n-pageset.manifest')
+                    self.tooltool_fetch(
+                        manifest_file,
+                        output_dir=src_talos_pageset,
+                        cache=self.config.get('tooltool_cache')
+                    )
+                    archive = os.path.join(src_talos_pageset, self.pagesets_name)
+                    unzip = self.query_exe('unzip')
+                    unzip_cmd = [unzip, '-q', '-o', archive, '-d', src_talos_pageset]
+                    self.run_command(unzip_cmd, halt_on_failure=True)
+                else:
+                    self.info("pageset already available")
             else:
                 self.info("Not downloading pageset because the no-download option was specified")
 
         # if running speedometer locally, need to copy speedometer source into talos/tests
         if self.config.get('run_local') and 'speedometer' in self.suite:
             self.get_speedometer_source()
 
     def get_speedometer_source(self):
--- a/testing/talos/mach_commands.py
+++ b/testing/talos/mach_commands.py
@@ -43,37 +43,39 @@ class TalosRunner(MozbuildObject):
         self.virtualenv_script = os.path.join(self.topsrcdir, 'third_party', 'python',
                                               'virtualenv', 'virtualenv.py')
         self.virtualenv_path = os.path.join(self._topobjdir, 'testing',
                                             'talos-venv')
         self.python_interp = sys.executable
         self.talos_args = talos_args
 
     def make_config(self):
+        default_actions = ['populate-webroot']
+        if not os.path.exists(self.virtualenv_path):
+            default_actions.append('create-virtualenv')
+        default_actions.extend([
+            'setup-mitmproxy',
+            'run-tests',
+        ])
         self.config = {
             'run_local': True,
             'talos_json': self.talos_json,
             'binary_path': self.binary_path,
             'repo_path': self.topsrcdir,
             'obj_path': self.topobjdir,
             'log_name': 'talos',
             'virtualenv_path': self.virtualenv_path,
             'pypi_url': 'http://pypi.python.org/simple',
             'base_work_dir': self.mozharness_dir,
             'exes': {
                 'python': self.python_interp,
                 'virtualenv': [self.python_interp, self.virtualenv_script]
             },
             'title': socket.gethostname(),
-            'default_actions': [
-                'populate-webroot',
-                'create-virtualenv',
-                'setup-mitmproxy',
-                'run-tests',
-            ],
+            'default_actions': default_actions,
             'download_tooltool': True,
             'talos_extra_options': ['--develop'] + self.talos_args,
             'python3_manifest': {
                 'win32': 'python3.manifest',
                 'win64': 'python3_x64.manifest',
             }
         }