jetperf
index
/home/aki/wrk/git-mozharness-ro/scripts/jetperf.py

Jetpack Performance Tests:
- https://wiki.mozilla.org/Auto-tools/Projects/JetPerf
- https://bugzilla.mozilla.org/show_bug.cgi?id=717036

 
Modules
       
copy
os
shutil
sys

 
Classes
       
mozharness.base.vcs.vcsbase.MercurialScript(mozharness.base.vcs.vcsbase.VCSScript)
JetPerf(mozharness.mozilla.testing.talos.Talos, mozharness.base.vcs.vcsbase.MercurialScript)
mozharness.mozilla.testing.talos.Talos(mozharness.mozilla.testing.testbase.TestingMixin, mozharness.base.script.BaseScript)
JetPerf(mozharness.mozilla.testing.talos.Talos, mozharness.base.vcs.vcsbase.MercurialScript)

 
class JetPerf(mozharness.mozilla.testing.talos.Talos, mozharness.base.vcs.vcsbase.MercurialScript)
    - Download the latest Add-on SDK
- Download the test add-on sources
- Build each test add-on with the add-ons SDK.
- Run the talos tests on Firefox standalone and then with each of the
  built add-ons installed.
 
 
Method resolution order:
JetPerf
mozharness.mozilla.testing.talos.Talos
mozharness.mozilla.testing.testbase.TestingMixin
mozharness.base.python.VirtualenvMixin
mozharness.mozilla.buildbot.BuildbotMixin
mozharness.base.vcs.vcsbase.MercurialScript
mozharness.base.vcs.vcsbase.VCSScript
mozharness.base.vcs.vcsbase.VCSMixin
mozharness.base.script.BaseScript
mozharness.base.script.ScriptMixin
mozharness.base.log.LogMixin
__builtin__.object

Methods defined here:
__init__(self, require_config_file=False)
addons_from_directory(self, directory)
scans a directory for jetpack addon sources and returns a list
baseline(self)
run baseline ts tests
baseline_results_filename(self)
build(self)
Build each test add-on with the add-ons SDK
cfx(self)
returns path to cfx
report_tbpl_status(self)
results_filename(self)
return the results file path from self.results_url
run_talos(self, name, *args, **kw)
runs PerfConfigurator and talos
test(self)
run talos tests

Data and other attributes defined here:
actions = ['clobber', 'pull', 'build', 'read-buildbot-config', 'download-and-extract', 'create-virtualenv', 'install', 'test', 'baseline']
config_options = [[['--talos-url'], {'action': 'store', 'default': 'http://hg.mozilla.org/build/talos/archive/tip.tar.gz', 'dest': 'talos_url', 'help': 'Specify the talos package url'}], [['--use-talos-json'], {'action': 'store_true', 'default': False, 'dest': 'use_talos_json', 'help': 'Use talos config from talos.json'}], [['--suite'], {'action': 'store', 'dest': 'suite', 'help': 'Talos suite to run (from talos json)'}], [['--branch-name'], {'action': 'store', 'dest': 'branch', 'help': 'Graphserver branch to report to'}], [['--system-bits'], {'action': 'store', 'choices': ['32', '64'], 'default': '32', 'dest': 'system_bits', 'help': 'Testing 32 or 64 (for talos json plugins)', 'type': 'choice'}], [['--add-option'], {'action': 'extend', 'default': None, 'dest': 'talos_extra_options', 'help': 'extra options to talos'}], [['-a', '--tests'], {'action': 'extend', 'default': [], 'dest': 'tests', 'help': 'Specify the tests to run'}], [['--results-url'], {'action': 'store', 'default': None, 'dest': 'results_url', 'help': 'URL to send results to'}], [['--installer-url'], {'action': 'store', 'default': None, 'dest': 'installer_url', 'help': 'URL to the installer to install'}], [['--installer-path'], {'action': 'store', 'default': None, 'dest': 'installer_path', 'help': 'Path to the installer to install. This is set automatically if run with --download-and-extract.'}], [['--binary-path'], {'action': 'store', 'default': None, 'dest': 'binary_path', 'help': 'Path to installed binary. This is set automatically if run with --install.'}], [['--test-url'], {'action': 'store', 'default': None, 'dest': 'test_url', 'help': 'URL to the zip file containing the actual tests'}], [['--download-symbols'], {'action': 'store', 'choices': ['ondemand', 'true'], 'dest': 'download_symbols', 'help': 'Download and extract crash reporter symbols.', 'type': 'choice'}], [['--venv-path', '--virtualenv-path'], {'action': 'store', 'default': 'venv', 'dest': 'virtualenv_path', 'help': 'Specify the path to the virtualenv top level directory'}], [['--virtualenv'], {'action': 'store', 'dest': 'virtualenv', 'help': 'Specify the virtualenv executable to use'}], [['--pypi-url'], {'action': 'store', 'dest': 'pypi_url', 'help': 'Base URL of Python Package Index (default http://pypi.python.org/simple/)'}], [['--find-links'], {'action': 'extend', 'dest': 'find_links', 'help': 'URL to look for packages at'}], [['--pip-index'], {'action': 'store_true', 'default': True, 'dest': 'pip_index', 'help': 'Use pip indexes (default)'}], [['--no-pip-index'], {'action': 'store_false', 'dest': 'pip_index', 'help': "Don't use pip indexes"}], [['--addon'], {'action': 'extend', 'default': [], 'dest': 'addon-directories', 'help': 'paths to addon directories'}]]
default_actions = ['clobber', 'pull', 'build', 'download-and-extract', 'create-virtualenv', 'install', 'test', 'baseline', 'report-tbpl-status']
default_repos = [{'dest': 'addon-sdk', 'repo': 'http://hg.mozilla.org/projects/addon-sdk', 'revision': 'default'}, {'dest': 'addons_clone', 'repo': 'http://hg.mozilla.org/projects/addon-sdk-jetperf-tests/', 'revision': 'default'}]

Methods inherited from mozharness.mozilla.testing.talos.Talos:
create_virtualenv(self, **kwargs)
VirtualenvMixin.create_virtualenv() assuemes we're using
self.config['virtualenv_modules'].  Since we're overriding talos_url
when using the talos json, we have to wrap that method here.
download_and_extract(self)
download_talos_json(self)
postflight_create_virtualenv(self)
This belongs in download_and_install() but requires the
virtualenv to be set up :(
 
The real fix here may be a --tpmanifest option for PerfConfigurator.
preflight_run_tests(self)
query_pagesets_manifest_path(self)
We have to copy the tp manifest from webroot to talos root when
those two directories aren't the same, until bug 795172 is fixed.
 
Helper method to avoid hardcodes.
query_pagesets_parent_dir_path(self)
We have to copy the pageset into the webroot separately.
 
Helper method to avoid hardcodes.
query_pagesets_url(self)
Certain suites require external pagesets to be downloaded and
extracted.
query_talos_json_config(self)
Return the talos json config; download and read from the
talos_json_url if need be.
query_talos_json_url(self)
Hacky, but I haven't figured out a better way to get the
talos json url before we install the build.
 
We can't get this information after we install the build, because
we have to create the virtualenv to use mozinstall, and talos_url
is specified in the talos json.
query_talos_options(self)
query_talos_url(self)
Where do we install the talos python package from?
This needs to be overrideable by the talos json.
query_tests(self)
Determine if we have tests to run.
 
Currently talos json will take precedence over config and command
line options; if that's not a good default we can switch the order.
run_tests(self, args=None, **kw)
run Talos tests
talos_conf_path(self, conf)
return the full path for a talos .yml configuration file
talos_options(self, args=None, **kw)
return options to talos

Methods inherited from mozharness.mozilla.testing.testbase.TestingMixin:
install(self)
Dependent on mozinstall
install_minidump_stackwalk(self)
postflight_read_buildbot_config(self)
Determine which files to download from the buildprops.json file
created via the buildbot ScriptFactory.
postflight_run_tests(self)
preflight commands for all tests
preflight_download_and_extract(self)
preflight_install(self)
query_minidump_stackwalk(self)
query_symbols_url(self)

Data and other attributes inherited from mozharness.mozilla.testing.testbase.TestingMixin:
binary_path = None
default_tools_repo = 'http://hg.mozilla.org/build/tools'
installer_path = None
installer_url = None
minidump_stackwalk_path = None
symbols_path = None
symbols_url = None
test_url = None
test_zip_path = None

Methods inherited from mozharness.base.python.VirtualenvMixin:
install_module(self, module=None, module_url=None, install_method=None, requirements=())
Install module via pip.
 
module_url can be a url to a python package tarball, a path to
a directory containing a setup.py (absolute or relative to work_dir)
or None, in which case it will default to the module name.
 
requirements is a list of pip requirements files.  If specified, these
will be combined with the module_url (if any), like so:
 
pip install -r requirements1.txt -r requirements2.txt module_url
is_python_package_installed(self, package_name, error_level='warning')
Return whether the package is installed
package_versions(self, pip_freeze_output=None, error_level='warning', log_output=False)
reads packages from `pip freeze` output and returns a dict of
{package_name: 'version'}
query_python_path(self, binary='python')
Return the path of a binary inside the virtualenv, if
c['virtualenv_path'] is set; otherwise return the binary name.
Otherwise return None
query_python_site_packages_path(self)
query_virtualenv_path(self)

Data descriptors inherited from mozharness.base.python.VirtualenvMixin:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from mozharness.base.python.VirtualenvMixin:
python_paths = {}
site_packages_path = None

Methods inherited from mozharness.mozilla.buildbot.BuildbotMixin:
buildbot_status(self, tbpl_status, level=None)
dump_buildbot_properties(self, prop_list=None, file_name='properties', error_level='error')
query_buildbot_property(self, prop_name)
query_is_nightly(self)
read_buildbot_config(self)
sendchange(self, downloadables=None)
set_buildbot_property(self, prop_name, prop_value, write_to_file=False)
tryserver_email(self)

Data and other attributes inherited from mozharness.mozilla.buildbot.BuildbotMixin:
buildbot_config = None
buildbot_properties = {}

Data and other attributes inherited from mozharness.base.vcs.vcsbase.MercurialScript:
default_vcs = 'hg'

Methods inherited from mozharness.base.vcs.vcsbase.VCSScript:
pull(self, repos=None, parent_dir=None)

Methods inherited from mozharness.base.vcs.vcsbase.VCSMixin:
query_dest(self, kwargs)
vcs_checkout(self, vcs=None, error_level='fatal', **kwargs)
Check out a single repo.
vcs_checkout_repos(self, repo_list, parent_dir=None, tag_override=None, **kwargs)
Check out a list of repos.

Methods inherited from mozharness.base.script.BaseScript:
action_message(self, message)
add_failure(self, key, message='%(key)s failed.', level='error')
add_summary(self, message, level='info')
clobber(self)
Delete the working directory
copy_logs_to_upload_dir(self)
Copies logs to the upload directory
copy_to_upload_dir(self, target, dest=None, short_desc='unknown', long_desc='unknown', log_level='debug', error_level='error', max_backups=None)
Copy target file to upload_dir/dest.
 
Potentially update a manifest in the future if we go that route.
 
Currently only copies a single file; would be nice to allow for
recursive copying; that would probably done by creating a helper
_copy_file_to_upload_dir().
 
short_desc and long_desc are placeholders for if/when we add
upload_dir manifests.
dump_config(self, file_path=None)
Dump self.config to localconfig.json
new_log_obj(self, default_log_level='info')
# logging {{{2
query_abs_dirs(self)
We want to be able to determine where all the important things
are.  Absolute paths lend themselves well to this, though I wouldn't
be surprised if this causes some issues somewhere.
 
This should be overridden in any script that has additional dirs
to query.
 
The query_* methods tend to set self.VAR variables as their
runtime cache.
query_failure(self, key)
run(self)
Default run method.
This is the "do everything" method, based on actions and all_actions.
 
First run dump_config() if it exists.
Second, go through the list of all_actions.
If they're in the list of self.actions, try to run
preflight_ACTION(), ACTION(), and postflight_ACTION().
 
Preflight is sanity checking before doing anything time consuming or
destructive.
 
Postflight is quick testing for success after an action.
summarize_success_count(self, success_count, total_count, message='%d of %d successful.', level=None)
summary(self)
Print out all the summary lines added via add_summary()
throughout the script.
 
I'd like to revisit how to do this in a prettier fashion.

Methods inherited from mozharness.base.script.ScriptMixin:
chdir(self, dir_name)
chmod(self, path, mode)
copyfile(self, src, dest, log_level='info', error_level='error', copystat=False)
copytree(self, src, dest, overwrite='no_overwrite', log_level='info', error_level='error')
an implementation of shutil.copytree however it allows for
dest to exist and implements different overwrite levels.
overwrite uses:
'no_overwrite' will keep all(any) existing files in destination tree
'overwrite_if_exists' will only overwrite destination paths that have
           the same path names relative to the root of the src and
           destination tree
'clobber' will replace the whole destination tree(clobber) if it exists
download_file(self, url, file_name=None, parent_dir=None, create_parent_dir=True, error_level='error', exit_code=-1)
Python wget.
get_filename_from_url(self, url)
get_output_from_command(self, command, cwd=None, halt_on_failure=False, env=None, silent=False, log_level='info', tmpfile_base_path='tmpfile', return_type='output', save_tmpfiles=False, throw_exception=False)
Similar to run_command, but where run_command is an
os.system(command) analog, get_output_from_command is a `command`
analog.
 
Less error checking by design, though if we figure out how to
do it without borking the output, great.
 
TODO: binary mode? silent is kinda like that.
TODO: since p.wait() can take a long time, optionally log something
every N seconds?
TODO: optionally only keep the first or last (N) line(s) of output?
TODO: optionally only return the tmp_stdout_filename?
mkdir_p(self, path, error_level='error')
Returns None for success, not None for failure
move(self, src, dest, log_level='info', error_level='error', exit_code=-1)
query_env(self, partial_env=None, replace_dict=None, set_self_env=None, log_level='debug')
Environment query/generation method.
 
The default, query_env(), will look for self.config['env']
and replace any special strings in there ( %(PATH)s ).
It will then store it as self.env for speeding things up later.
 
If you specify partial_env, partial_env will be used instead of
self.config['env'], and we don't save self.env as it's a one-off.
query_exe(self, exe_name, exe_dict='exes', default=None, return_type=None, error_level='fatal')
One way to work around PATH rewrites.
 
By default, return exe_name, and we'll fall through to searching
os.environ["PATH"].
However, if self.config[exe_dict][exe_name] exists, return that.
This lets us override exe paths via config file.
 
'return_type' can be None (don't do anything to the value),
'list' (return a list), or 'string' (return a string).
 
If we need runtime setting, we can build in self.exes support later.
query_msys_path(self, path)
read_from_file(self, file_path, verbose=True, open_mode='r', error_level='error')
Reads from file_path.
 
Returns contents if successful, None if not.
retry(self, action, attempts=None, sleeptime=60, max_sleeptime=300, retry_exceptions=(<type 'exceptions.Exception'>,), good_statuses=None, cleanup=None, error_level='error', error_message='%(action)s failed after %(attempts)d tries!', failure_status=-1, args=(), kwargs={})
Generic retry command.
Ported from tools util.retry.
 
Call `action' a maximum of `attempts' times until it succeeds,
defaulting to self.config.get('global_retries', 5).
 
`sleeptime' is the number of seconds to wait between attempts,
defaulting to 60 and doubling each retry attempt, to a maximum of
`max_sleeptime'.
 
`retry_exceptions' is a tuple of Exceptions that should be caught.
If exceptions other than those listed in `retry_exceptions' are
raised from `action', they will be raised immediately.
 
`good_statuses' is a tuple of return values which, if specified,
will result in retrying if the return value isn't listed.
 
If `cleanup' is provided and callable it will be called immediately
after an Exception is caught.  No arguments will be passed to it.
If your cleanup function requires arguments it is recommended that
you wrap it in an argumentless function.
 
`args' and `kwargs' are a tuple and dict of arguments to pass onto
to `callable'.
rmtree(self, path, log_level='info', error_level='error', exit_code=-1)
Returns None for success, not None for failure
run_command(self, command, cwd=None, error_list=None, parse_at_end=False, halt_on_failure=False, success_codes=None, env=None, return_type='status', throw_exception=False, output_parser=None)
Run a command, with logging and error parsing.
 
TODO: parse_at_end, context_lines
TODO: retry_interval?
TODO: error_level_override?
TODO: Add a copy-pastable version of |command| if it's a list.
TODO: print env if set
 
output_parser lets you provide an instance of your own OutputParser
subclass, or pass None to use OutputParser.
 
error_list example:
[{'regex': re.compile('^Error: LOL J/K'), level=IGNORE},
 {'regex': re.compile('^Error:'), level=ERROR, contextLines='5:5'},
 {'substr': 'THE WORLD IS ENDING', level=FATAL, contextLines='20:'}
]
(context_lines isn't written yet)
which(self, program)
OS independent implementation of Unix's which command
Takes in a program name
Returns path to executable or None
write_to_file(self, file_path, contents, verbose=True, open_mode='w', create_parent_dir=False, error_level='error')
Write contents to file_path.
 
This doesn't currently create the parent_dir or translate into
abs_path; that needs to be done beforehand, since ScriptMixin doesn't
necessarily have access to query_abs_dirs().
 
Returns file_path if successful, None if not.

Data and other attributes inherited from mozharness.base.script.ScriptMixin:
env = None

Methods inherited from mozharness.base.log.LogMixin:
critical(self, message)
debug(self, message)
error(self, message)
exception(self, message=None, level='error')
# Copying Bear's dumpException():
http://hg.mozilla.org/build/tools/annotate/1485f23c38e0/sut_tools/sut_lib.py#l23
fatal(self, message, exit_code=-1)
info(self, message)
log(self, message, level='info', exit_code=-1)
warning(self, message)

 
Functions
       
main(args=['-w', 'scripts/jetperf.py'])
CLI entry point

 
Data
        TBPL_SUCCESS = 'SUCCESS'
TBPL_WARNING = 'WARNING'