Граф коммитов

29 Коммитов

Автор SHA1 Сообщение Дата
Gregory Szorc 0084dc7475 Bug 1461221 - Account for psutil.disk_io_counters() returning None; r=mshal
Apparently it can do this.

MozReview-Commit-ID: 6gMTGtcRAw6

--HG--
extra : rebase_source : 1e89583b3c15c85d1c86969f101358864c0e2e34
2018-05-15 12:02:46 -07:00
Andrew Halberstadt f354075c7a Bug 1434430 - [flake8] Fix blank 'except' statements r=rwood
This is a new issue that gets linted with flake8 3.5.0. Basically you should
never use a blank except: statement.

This will catch all exceptions, including KeyboardInterrupt and SystemExit
(which is likely not intended). If a catch all is needed, use
`except: Exception`.  If you *really* mean to also catch KeyboardInterrupt et
al, use `except: BaseException`.

Of course, being specific is often better than a catch all.

MozReview-Commit-ID: FKx80MLO4RN

--HG--
extra : rebase_source : 7c74a7d0d81f2c984b47aff3a0ee3448b791177b
2018-01-31 14:32:08 -05:00
Tom Prince a45ea20b93 Bug 1413575: Adjust in-tree references to mozbase documentation to point in-tree. r=ahal
MozReview-Commit-ID: rctbByyjTA

--HG--
extra : rebase_source : a682eb6d77b79640ac9ec20e9d64340613bcfed7
2017-11-20 11:43:13 -07:00
Steve Armand fa0b6e7c7e Bug 1397849 - Enable py2 and py3 linter on testing/mozbase. r=ahal
MozReview-Commit-ID: GnaVLhtO4un

--HG--
extra : rebase_source : 8839a423c5db505469b813957649b1605ed5737f
2017-09-25 22:57:18 -04:00
Mike Hommey 2874ecd82e Bug 1384062 - Make SystemResourceMonitor.stop more resilient to errors. r=ahal,gps
The poll() call in SystemResourceMonitor.stop might fail even though
there is something to read from the pipe, in some corner cases, and
python won't let us know about it. In that case, an exception is thrown,
leaving the SystemResourceMonitor (and its callers) in a weird state. In
practice, this leads BuildMonitor.__exit__ to recall stop, which then
fails.

So when poll() throws an exception, we pretend there's still something
to read, and we try to read anyways. If there is something to read,
recv() will return it, otherwise, it will throw an exception of its own,
which we catch, pretending we're done.

Furthermore, when there is nothing to read from the pipe, poll() simply
returns False, and our loop never sets `done` to True, and we then hit
an assert, which doesn't have its place here, so we remove it.

Finally, the other end of the pipe might have died at any time, making
sending over the pipe fail, so we also protect against that.

With all these changes, it feels like the reason to backout bug 1239939
in bug 1272782 should have been dealt with, and we can drop the timeout
again.

--HG--
extra : rebase_source : ac72dd5b2602cf3ffddfb429f95e02380f939893
2017-08-16 13:16:16 +09:00
Phil Ringnalda cbc5805a36 Backed out changeset 4e9cd1d537cc (bug 1384062) for flake8 failures
MozReview-Commit-ID: C2AVg8g3xpV
2017-08-17 20:39:43 -07:00
Mike Hommey 452fa31f52 Bug 1384062 - Make SystemResourceMonitor.stop more resilient to errors. r=ahal,gps
The poll() call in SystemResourceMonitor.stop might fail even though
there is something to read from the pipe, in some corner cases, and
python won't let us know about it. In that case, an exception is thrown,
leaving the SystemResourceMonitor (and its callers) in a weird state. In
practice, this leads BuildMonitor.__exit__ to recall stop, which then
fails.

So when poll() throws an exception, we pretend there's still something
to read, and we try to read anyways. If there is something to read,
recv() will return it, otherwise, it will throw an exception of its own,
which we catch, pretending we're done.

Furthermore, when there is nothing to read from the pipe, poll() simply
returns False, and our loop never sets `done` to True, and we then hit
an assert, which doesn't have its place here, so we remove it.

Finally, the other end of the pipe might have died at any time, making
sending over the pipe fail, so we also protect against that.

With all these changes, it feels like the reason to backout bug 1239939
in bug 1272782 should have been dealt with, and we can drop the timeout
again.

--HG--
extra : rebase_source : fededf989fe9021654b67d5a070f7e49aa717f3c
2017-08-16 13:16:16 +09:00
Andrew Halberstadt 8415b25e37 Bug 1003417 - Add a 'mozbase' subsuite to python unittests on linux, r=ted
The subsuite is added conditionally because we only have the capability of
running source-check tasks on linux at the moment. Once taskcluster support
for windows and mac has matured a bit and the taskcluster configs support
source-check there, we should apply the subuite unconditionally.

MozReview-Commit-ID: Kk9Irz3fn14

--HG--
extra : rebase_source : b9266a06583083c36477d4e93f5462ee614cdb71
2016-11-16 16:43:42 -05:00
Jim Chen e6583a6227 Bug 1335127 - Fall back to stub IO counters when psutil fails; r=gps
The fallback at [1], when psutil.disk_io_counters() fails, returns a
simple list but callers to get_disk_io_counters() expect an object with
specific properties. Returning a stub object from PsutilStub fixes that.

[1] https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py#67
2017-02-01 17:26:51 -05:00
Andrew Halberstadt 2d76b4f70d Bug 1317970 - Make mozbase tests use mozunit for consistent formatting, r=chmanchester
The mozbase unittests don't use mozunit, so their output is confusing in the log.
This makes mozbase output consistent with the rest of the python unittests.

MozReview-Commit-ID: AIs5mza8Rn6

--HG--
extra : rebase_source : 10f65e612f5b3cebb921c47699f5a8be7cd2ba5a
2016-11-17 16:36:18 -05:00
Andrew Halberstadt f395e4d6dd Bug 1317970 - Move mozsystemmonitor tests to a consistent directory structure, r=chmanchester
The mozsystemmonitor test is under mozsystemmonitor/mozsystemmonitor/test instead of
mozsystemmonitor/tests like all the other mozbase modules.

MozReview-Commit-ID: AIs5mza8Rn6

--HG--
rename : testing/mozbase/mozsystemmonitor/mozsystemmonitor/test/test_resource_monitor.py => testing/mozbase/mozsystemmonitor/tests/test_resource_monitor.py
extra : rebase_source : dde714fb9212f19d1f8ba566f574bd7e9d7c4030
2016-11-17 16:36:13 -05:00
Francesco Pischedda f45ed99748 Bug 1280573 - Add testing/mozbase to flake8 linter: r=ahal
added testing/mozbase to tools/lint/flake8.lint
fixed a first batch of PEP8 errors/warnings

at first the commad autopep8 -i --max-line-length 99 -r -j 8 .
has been used to fix simpler problems, run from testing/mozbase

some of the issues can not easily fixed :
- undefined 'names' in code for example isLinux - isLinux and isBsd "fixed" with # noqa
- undefined 'message' resolved with return fmt.format(...
- undefined 'structured' resolved replacing those with mozlog
- long comments - some remaining - addressed with # noqa
- package level import everything - addressed with # flake8: noqa

restored testing/mozbase/mozdevice/mozdevice/Zeroconf.py
fixed issues reported on mozreview
fixed ')' in testing/mozbase/mozprocess/mozprocess/qijo.py imports
finally fixed multiline string at testing/mozbase/manifestparser/tests/test_manifestparser.py:114
^^^ and again, but now with ./mach python-test --path-only testing/mozbase/manifestparser/tests/test_manifestparser.py passing
fixed testing/mozbase/manifestparser/tests/test_convert_directory.py assert

fixed this error:
10:15:21     INFO -      return lambda line: stack_fixer_module.fixSymbols(line)
10:15:21     INFO -  TypeError: fixSymbols() takes exactly 2 arguments (1 given)

fixed two spaces lint error even of #  noqa comments
restored assignement to lambda with #  noqa to silence the lint error
global noqa for testing/mozbase/manifestparser/tests/test_filters.py
stupid is/is not error...

MozReview-Commit-ID: 1FpJF54GqIi

--HG--
extra : rebase_source : 3cf0277fb36a296e3506aeacc2ff05e1b03f9eac
2016-09-30 16:08:37 +02:00
Gregory Szorc d575271cc0 Bug 1272782 - Bump mozsystemmonitor version to 0.3; r=ahal
So we can release the bug fixes we just made.

MozReview-Commit-ID: HgfPQkkwd6r

--HG--
extra : rebase_source : 62a85de968b26230721939838ca4d29d6600b186
2016-05-13 14:11:40 -07:00
Gregory Szorc e16f5d1baa Bug 1272782 - Don't wait forever for child process to exit; r=ahal
I believe this is the source of hangs/timeouts in automation.
join() waits forever. We add code to wait at most N seconds before
force terminating the process. The timeout is a bit high. But it is
better than infinite.

MozReview-Commit-ID: KwyO4RZ9OqL

--HG--
extra : rebase_source : 767d8ff5b48d7e75ab8fe72b18145446a38d439a
2016-05-13 14:10:39 -07:00
Gregory Szorc 49e64768b0 Bug 1272782 - Wait longer and stop after "done" message; r=ahal
Before, we kept waiting for data in the pipe after receiving the
"done" message. This didn't really make much sense because the
"done" message should be the final thing sent over the pipe!

e9113fd6cdb8 (bug 1239939) recently dropped the poll interval
of the pipe from 1.0 to 0.1s. This appears to have introduced
an intermittent failure in a test. The race condition was
between the child process sending data and the parent process
timing out (after only 0.1s) waiting for that data. Increasing
the timeout makes the failure reproduce less often. Although
technically the race condition is still present! I'm not
inclined to fix it at this time, however.

The rationale for dropping the pipe timeout was that it was
causing lag when terminating short-lived processes. Now that
we abort the pipe reading/polling loop as soon as the "done"
message is received, we no longer poll the pipe after receiving
"done" and no longer have to worry about its timeout impacting
shutdown time.

MozReview-Commit-ID: EeENQ95RAs1

--HG--
extra : rebase_source : ce2502f32841a55f912aafdba7cc81e3a58e3ff5
2016-05-13 14:05:17 -07:00
Gregory Szorc 4b05251aa6 Bug 1272782 - Send tuple properly; r=ahal
Found this bug when auditing the code for issues. We are attempting
to send a tuple but were forgetting the trailing comma on a single
element tuple.

Fortunately, this doesn't appear to impact anything because
the receiving end of the pipe doesn't care what data it receives.

MozReview-Commit-ID: E34fBqxgUSq

--HG--
extra : rebase_source : 3701a28979a8b53d40ea68acef3ee2cb6d8a50f2
2016-05-13 13:57:59 -07:00
Gregory Szorc f03abf7727 Bug 1272541 - Bump mozsystemmonitor to version 0.2; r=ahal
So we can release the new as_dict() goodies.

MozReview-Commit-ID: JNQ3jA2U450

--HG--
extra : rebase_source : 6f17ed7395033d75e28f1ed4db468b2865da739a
2016-05-12 18:48:32 -07:00
Gregory Szorc 3dd91a28c7 Bug 1272541 - Expose more data from SystemResourceMonitor.as_dict; r=ahal
We add some system information including processor count
and memory sizes. We also add an "overall" section describing
total resource usage. This (surprisingly) wasn't defined.

This commit is the first in a series to reconcile the differences
between the JSON format in mozsystemmonitor and what
`mach build` writes so we can write a single tool to visualize
the data.

MozReview-Commit-ID: 9mdbKxeV9Ta

--HG--
extra : rebase_source : 3aadf5e83c91ba9553595f3da77ed7ca0e4d5541
2016-05-12 18:03:16 -07:00
Gregory Szorc 17d5d5efa5 Bug 1272202 - Bump version of mozsystemmonitor to 0.1; r=jlund
We're currently running version 0.0 in automation. This version
doesn't have as_dict(), which means we can't easily save data
to JSON.

Bump the version to 0.1 in preparation of releasing a new
version.

MozReview-Commit-ID: Kr3JqyRXk5j

--HG--
extra : rebase_source : 89f763acaa12e4357f4a23f8772f99c1a0fdb56f
2016-05-12 15:42:07 -07:00
Gregory Szorc d25774bf41 Bug 1272202 - Require psutil >= 3.1.1 in mozsystemmonitor; r=jlund
We have packages for 3.1.1 uploaded to our PyPI server used
for automation. There have been a number of bug fixes since the
version of psutil currently listed. Let's ensure we're running
a modern psutil to minimize our exposure to bugs on older
versions.

MozReview-Commit-ID: 6rDapZ8miFD

--HG--
extra : rebase_source : c66295828e0c95c4ffe57e579df41af508875027
2016-05-12 15:40:39 -07:00
Dan Minor ab69635d0b Bug 1239939 - [mozsystemmonitor] Reduce poll interval on exit r=wlach
Currently we poll at an interval of 1 second when shutting down
mozsystemmonitor. This causes a noticeable shutdown delay on short
running processes. Reducing the interval to 0.1 reduces this delay without
seeming to have any adverse effects.

--HG--
extra : rebase_source : da59ee8d09ada188d011e3a7138b30d91850aacd
2016-01-18 06:28:10 -05:00
Mike Shal 734f1f54fe Bug 1162594 - create build_resources.json even if psutil fails; r=ahal 2015-06-09 18:22:53 -04:00
Gregory Szorc 63c60857b5 Bug 1116194 - Catch errors calling psutil; r=ted
The build system / mach currently has a very hacky virtualenv setup.
Essentially, it resorts to sys.path munging instead of a proper,
isolated environment.

During initialization, mach installs python/psutil in sys.path. Later
on, some code does an |import psutil|. This fails iff the psutil C
extension can't be found.

If there is a psutil C extension installed outside of mach and
python/psutil, |import psutil| may load it. The version mismatch isn't
detected until an extension-using psutil API is called. This has
manifested inside |mach build| via the resource monitor as an
|AttributeError: 'module' object has no attribute 'linux_sysinfo'|
exception during psutil.virtual_memory().

The proper fix for this is for the Python environment to ensure the
psutil C extension is built before attempting to import and use psutil.
Arguably, psutil itself should perform some kind of version check when
it imports the C extension to ensure things are in sync and fail at
import time.

Fixing mach and the build system Python environment to build psutil
earlier/properly is a long outstanding bug. It needs to be addressed.
But it is considerable effort. This patch continues the long history of
wallpapering over psutil import/run failures because using a proper
virutalenv from mach/build system is a lot of work. Sad panda.

--HG--
extra : rebase_source : 5c449d69c0fd907ea8359ac721ef6287baa4f10e
2014-12-29 12:06:21 -08:00
Mike Shal 1faea8e362 Bug 1013730 - Have mach ignore broken disk io stats; r=gps
This works around the "RuntimeError: couldn't find any physical disk"
issue on Windows when using 'diskperf -n'
2014-10-01 13:14:58 -04:00
Chris Manchester 1c97de1410 Bug 1035006 - Fix pyflakes warnings in mozbase.;r=wlach 2014-07-07 14:51:34 -04:00
Gregory Szorc e079fd36ed Bug 907331 - Ability to convert resource usage to a serializable dict; r=ahal
--HG--
extra : rebase_source : b1e7f40e72ae50d1fde04a6935de17740f72c918
2014-05-23 14:08:04 -07:00
Gregory Szorc 4aae58c4bb Bug 908296 - Catch all exceptions when importing psutil; r=ted
--HG--
extra : rebase_source : 7260ae283344fd8db3ef22923c33f9dc2166cc5f
2013-08-23 10:50:28 -07:00
Gregory Szorc 23d3390f26 Bug 907797 - Catch NotImplementedError when importing psutil; r=ahal 2013-08-21 09:56:36 -07:00
Gregory Szorc 63eccd6385 Bug 883205 - Add mozsystemmonitor to mozbase; r=ahal 2013-06-14 15:15:58 -07:00