Closed Bug 1272202 Opened 9 years ago Closed 9 years ago

Upload resource monitor JSON as job artifact

Categories

(Release Engineering :: Applications: MozharnessCore, defect)

defect
Not set
normal

Tracking

(firefox49 fixed)

RESOLVED FIXED
Tracking Status
firefox49 --- fixed

People

(Reporter: gps, Assigned: gps)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

The resource monitor integrated with mozharness has the ability to export its data as JSON. We should upload this JSON file as a job artifact. Maybe once this is done we could integrate an HTML viewer into Treeherder. We already have an HTML viewer in mozilla-central (`mach resource-usage`). It is very crude and ugly. But it gets the job done.
Data is too valuable to waste. Let's upload the raw resource data captured by the resource monitor so we can look at resource usage in more detail whenever we want. Review commit: https://reviewboard.mozilla.org/r/52237/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/52237/
Attachment #8751831 - Flags: review?(jlund)
Assignee: nobody → gps
Status: NEW → ASSIGNED
Comment on attachment 8751831 [details] MozReview Request: Bug 1272202 - Upload raw resource usage data; r?jlund Review request updated; see interdiff: https://reviewboard.mozilla.org/r/52237/diff/1-2/
Comment on attachment 8751831 [details] MozReview Request: Bug 1272202 - Upload raw resource usage data; r?jlund https://reviewboard.mozilla.org/r/52237/#review49187 non issues. just some fyi's about mozharness core offerings ::: testing/mozharness/mozharness/base/python.py:513 (Diff revision 1) > self._log_resource_usage() > + > + # Upload a JSON file containing the raw resource data. > + try: > + upload_dir = self.query_abs_dirs()['abs_upload_dir'] > + with open(os.path.join(upload_dir, 'resource-usage.json'), 'wb') as fh: could use self.dump_config[1] here but I think I prefer this as it provides try/catch and uses the more readable with statement [1] https://dxr.mozilla.org/mozilla-central/source/testing/mozharness/mozharness/base/script.py# ::: testing/mozharness/mozharness/base/python.py:517 (Diff revision 1) > + upload_dir = self.query_abs_dirs()['abs_upload_dir'] > + with open(os.path.join(upload_dir, 'resource-usage.json'), 'wb') as fh: > + json.dump(self._resource_monitor.as_dict(), fh, > + sort_keys=True, indent=4) > + except (AttributeError, KeyError): > + self.warning('could not upload resource usage JSON: %s' % fyi - you can use self.exception(message, level=WARNING)[2] and it will extend the log output with the traceback for your [2] https://dxr.mozilla.org/mozilla-central/source/testing/mozharness/mozharness/base/log.py#157
Attachment #8751831 - Flags: review?(jlund)
Comment on attachment 8751831 [details] MozReview Request: Bug 1272202 - Upload raw resource usage data; r?jlund Review request updated; see interdiff: https://reviewboard.mozilla.org/r/52237/diff/2-3/
Attachment #8751831 - Flags: review?(jlund)
Comment on attachment 8751831 [details] MozReview Request: Bug 1272202 - Upload raw resource usage data; r?jlund Review request updated; see interdiff: https://reviewboard.mozilla.org/r/52237/diff/3-4/
Comment on attachment 8751831 [details] MozReview Request: Bug 1272202 - Upload raw resource usage data; r?jlund https://reviewboard.mozilla.org/r/52237/#review49209 ::: testing/mozharness/mozharness/base/python.py:512 (Diff revision 4) > self._resource_monitor.stop() > self._log_resource_usage() > + > + # Upload a JSON file containing the raw resource data. > + try: > + upload_dir = self.query_abs_dirs()['abs_blob_upload_dir'] hm, come to think of it. I wonder if every job that will have a abs_blob_upload_dir defined? be interesting to see which jobs raise the exception you have defined.
Attachment #8751831 - Flags: review?(jlund) → review+
https://reviewboard.mozilla.org/r/52237/#review49209 > hm, come to think of it. I wonder if every job that will have a abs_blob_upload_dir defined? be interesting to see which jobs raise the exception you have defined. The exceptions I've seen so far are due to the resource monitor not having an `as_dict` method. I reckon we aren't running a modern version of that package in automation. Time to sift through virtualenv logs. Yay.
Here is a source archive for the mozsystemmonitor Python package. Please upload it to our public PyPI mirror at http://pypi.pub.build.mozilla.org/pub/.
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. Review commit: https://reviewboard.mozilla.org/r/52325/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/52325/
Attachment #8751964 - Flags: review?(jlund)
Attachment #8751965 - Flags: review?(jlund)
Attachment #8751966 - Flags: review?(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. Review commit: https://reviewboard.mozilla.org/r/52327/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/52327/
mozsystemmonitor 0.1 has been released. It features support for retrieving a dict of gathered data, making JSON export easy. Let's use it. This version also requires psutil>=3.1.1, so bump that version as well. Review commit: https://reviewboard.mozilla.org/r/52329/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/52329/
Comment on attachment 8751831 [details] MozReview Request: Bug 1272202 - Upload raw resource usage data; r?jlund Review request updated; see interdiff: https://reviewboard.mozilla.org/r/52237/diff/4-5/
(In reply to Gregory Szorc [:gps] from comment #8) > Created attachment 8751962 [details] > mozsystemmonitor-0.1.tar.gz > > Here is a source archive for the mozsystemmonitor Python package. Please > upload it to our public PyPI mirror at > http://pypi.pub.build.mozilla.org/pub/. done: curl -I http://pypi.pub.build.mozilla.org/pub/mozsystemmonitor-0.1.tar.gz ... HTTP/1.1 200 OK
Comment on attachment 8751964 [details] MozReview Request: Bug 1272202 - Require psutil >= 3.1.1 in mozsystemmonitor; r?jlund https://reviewboard.mozilla.org/r/52325/#review49255
Attachment #8751964 - Flags: review?(jlund) → review+
Comment on attachment 8751965 [details] MozReview Request: Bug 1272202 - Bump version of mozsystemmonitor to 0.1; r?jlund https://reviewboard.mozilla.org/r/52327/#review49257
Attachment #8751965 - Flags: review?(jlund) → review+
Comment on attachment 8751966 [details] MozReview Request: Bug 1272202 - Bump psutil and mozsystemmonitor package versions; r?jlund https://reviewboard.mozilla.org/r/52329/#review49259
Attachment #8751966 - Flags: review?(jlund) → review+
Blocks: 1272539
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: