Make mozlog usable in mozharness

RESOLVED FIXED

Status

Release Engineering
Mozharness
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: jgraham, Assigned: chmanchester)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/2602] )

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

3 years ago
This is needed to make structured logging work better with mozharness. Since it's needed as part of the mozharness scripts themselves, it looks like we can't pip install it, but will have to copy over the library, like is done for mozfile and mozprocess.

Updated

3 years ago
Component: General Automation → Mozharness
Created attachment 8488833 [details] [diff] [review]
Do a deferred import of mozlog when structuredlog.py is invoked in mozharness.

This is being worked around for the tbplformatter by deferring the import of the formatter. This exposes the module in a similar fashion as a member of the StructuredOutputParser so other parts of mozlog can be accessed from within this class.
Attachment #8488833 - Flags: review?(james)
Assignee: nobody → cmanchester
Status: NEW → ASSIGNED
Blocks: 1068138
(Reporter)

Comment 2

3 years ago
Comment on attachment 8488833 [details] [diff] [review]
Do a deferred import of mozlog when structuredlog.py is invoked in mozharness.

Review of attachment 8488833 [details] [diff] [review]:
-----------------------------------------------------------------

::: mozharness/mozilla/structuredlog.py
@@ +17,5 @@
>      def __init__(self, **kwargs):
>          """Object that tracks the overall status of the test run"""
>          super(StructuredOutputParser, self).__init__(**kwargs)
>          self.unexpected_count = 0
> +        self.mozlog = self._get_mozlog_module()

Setting this as a property here seems rather odd, but I guess it's OK. Not sure if we need the whole of mozlog or just mozlog.structured, really.
Attachment #8488833 - Flags: review?(james) → review+
Created attachment 8491690 [details] [diff] [review]
Do a deferred import of mozlog when structuredlog.py is invoked in mozharness.

I certainly only plan to use structured! Removed the member because it's probably not necessary. If we need it later we could make this a global or actually install mozlog.

Looks fine running wpt locally.
Attachment #8491690 - Flags: review?(james)
Attachment #8488833 - Attachment is obsolete: true
(Reporter)

Updated

3 years ago
Attachment #8491690 - Flags: review?(james) → review+
https://hg.mozilla.org/build/mozharness/rev/e0a51cf8f7c8

Comment 5

3 years ago
Comment on attachment 8491690 [details] [diff] [review]
Do a deferred import of mozlog when structuredlog.py is invoked in mozharness.

live in production: http://hg.mozilla.org/build/mozharness/rev/0e4582e4b857
Attachment #8491690 - Flags: checked-in+

Updated

3 years ago
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/2602]
I think we've taken this as far as we need to for the moment.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.