New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 749840 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Feature



Sign in to add a comment

Report OSX CPU temperature as a Swarming state

Project Member Reported by mar...@chromium.org, Jul 27 2017

Issue description

Once working, quarantine on very high temperature; specific value to be determined.

Will be particularly useful with MacBookPros.

Also see issue 618123 which is slightly related.
 

Comment 1 by kbr@chromium.org, Jul 27 2017

Owner: kbr@chromium.org
Status: Assigned (was: Unconfirmed)
maruel@ found https://github.com/lavoiesl/osx-cpu-temp/blob/master/smc.c which looks very useful.

Let me take a shot at this.

Comment 2 by kbr@chromium.org, Jul 28 2017

Owner: mar...@chromium.org
Managed to port it to Python using a combination of the pyobjc bridge (for the functions requiring things like Core Foundation objects) and ctypes (for IOConnectCallStructMethod). It might have been possible to hack the headers used to generate the Objective-C bridge to always take SMCKeyData_t* instead of void*, but the pyobjc bridge is missing basic functionality like querying the size of structs for which it generates accessors, so I didn't try that once I realized I couldn't easily pass down pyobjc's allocated structs.

maruel@: would you mind integrating this into the Swarming server code? Happy to help update it with any needed changes.

smc-queries-from-python.zip
5.6 KB Download
Project Member

Comment 3 by bugdroid1@chromium.org, Jul 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/external/github.com/luci/luci-py.git/+/13d61ef9aea5822094a129b0fa6150130f5b8245

commit 13d61ef9aea5822094a129b0fa6150130f5b8245
Author: maruel <maruel@chromium.org>
Date: Fri Jul 28 21:10:57 2017

swarming: report CPU temperature on OSX as state.

Manually encode the call prototype instead of using the pyobjc bridge. It's both
faster and the Object-C python bridge unconditionally writes to stderr, which is
annoying. So in the end, the code calls Object-C functions via ctypes.
Everything is fine.

Fix OSX state values to all be unicode.

R=vadimsh@chromium.org
BUG= 749840 

Review-Url: https://codereview.chromium.org/2987023002

[modify] https://crrev.com/13d61ef9aea5822094a129b0fa6150130f5b8245/appengine/swarming/swarming_bot/api/os_utilities.py
[modify] https://crrev.com/13d61ef9aea5822094a129b0fa6150130f5b8245/appengine/swarming/swarming_bot/api/platforms/osx.py

Project Member

Comment 4 by bugdroid1@chromium.org, Aug 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/external/github.com/luci/luci-py.git/+/a5bd199073d6032880cd9d268cc47b0a59689ea7

commit a5bd199073d6032880cd9d268cc47b0a59689ea7
Author: maruel <maruel@chromium.org>
Date: Tue Aug 01 16:57:29 2017

swarming: round OSX temperature readings to 2 digits, trim sensor readings

- Some sensor readings had too much precision. It's not useful to have more
  precision than 2 fractional digits, since the sensors are likely not as
  accurate anyway.
- Renamed 'cpu0 proximity' to 'cpu0'.
- Renamed the two 'power supply' to be able to figure out which of the two is
  useful. A follow up CL will clean this out specifically.
- Commented out most sensors, including the gpu0 ones.
- Keep the sensors that looked potentially most useful from making the previous
  code live on production. Here's what will be kept with what is currently
  advertized by each hardware platform:

    MacBookAir7,1: cpu0, enclosure bottom (build125-b1)
    MacBookPro11,3: cpu0, enclosure bottom (build101-b1)
    MacPro6,1: ambient, cpu0 (build11-m4)
    Macmini5,3: ambient, cpu0, power supply (build12-b1)
    Macmini7,1: ambient, cpu0, power supply (build186-m4)

R=vadimsh@chromium.org
BUG= 749840 

Review-Url: https://codereview.chromium.org/2993523002

[modify] https://crrev.com/a5bd199073d6032880cd9d268cc47b0a59689ea7/appengine/swarming/swarming_bot/api/platforms/osx.py

Project Member

Comment 5 by bugdroid1@chromium.org, Aug 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/external/github.com/luci/luci-py.git/+/5d2675b14a7e4901352587f172ac0113033c9235

commit 5d2675b14a7e4901352587f172ac0113033c9235
Author: maruel <maruel@chromium.org>
Date: Tue Aug 01 18:47:29 2017

Swarming: final update for OSX temperature reporting

- Rename 'cpu0' to 'cpu'.
- Rename 'gpu0 diode' to 'gpu' and comment out 'gpu proximity'.
- Rename 'power supply C' to 'power supply' and comment out 'power supply P'.
  The later was not observed in practice.

R=vadimsh@chromium.org
BUG= 749840 

Review-Url: https://codereview.chromium.org/2989213002

[modify] https://crrev.com/5d2675b14a7e4901352587f172ac0113033c9235/appengine/swarming/swarming_bot/api/platforms/osx.py

Status: Fixed (was: Assigned)
This is live and pretty cool IMHO. Unsurprisingly, the MacBook Airs run their CPU incredibly hot, so doing active thermal throttling like we do on Android may be worth.
Status: Assigned (was: Fixed)
Reopening for automatic quarantining.
Project Member

Comment 8 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/infradata/config/+/9007f77bd79342712daceb113865be2eab0962a2

commit 9007f77bd79342712daceb113865be2eab0962a2
Author: Marc-Antoine Ruel <maruel@chromium.org>
Date: Thu Aug 03 17:23:57 2017

Project Member

Comment 9 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/infradata/config/+/d3eba78ee6591faf59d71ea56ed963cc055947e5

commit d3eba78ee6591faf59d71ea56ed963cc055947e5
Author: Marc-Antoine Ruel <maruel@chromium.org>
Date: Thu Aug 03 17:32:56 2017

Project Member

Comment 10 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/infradata/config/+/e12ac21b572066f5ee6402312010fcbb4b97287d

commit e12ac21b572066f5ee6402312010fcbb4b97287d
Author: Marc-Antoine Ruel <maruel@chromium.org>
Date: Thu Aug 03 17:43:45 2017

Project Member

Comment 11 by bugdroid1@chromium.org, Aug 7 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/infradata/config/+/029a0e7e9d5571359b56d3603645771943ff615d

commit 029a0e7e9d5571359b56d3603645771943ff615d
Author: Marc-Antoine Ruel <maruel@chromium.org>
Date: Mon Aug 07 23:04:58 2017

Project Member

Comment 12 by bugdroid1@chromium.org, Aug 8 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/infradata/config/+/c423cd7d0df8d3cba609987716b5e925d3573ae9

commit c423cd7d0df8d3cba609987716b5e925d3573ae9
Author: Marc-Antoine Ruel <maruel@chromium.org>
Date: Tue Aug 08 17:20:49 2017

Status: Fixed (was: Assigned)
It's live on prod. I had forgot to mark this bug as fixed.

Sign in to add a comment