pyJoules icon indicating copy to clipboard operation
pyJoules copied to clipboard

Printing the output

Open prachikashikar opened this issue 2 years ago • 0 comments

Hi ,

How to see the output after,

from pyJoules.device import DeviceFactory from pyJoules.device.rapl_device import RaplPackageDomain, RaplDramDomain from pyJoules.device.nvidia_device import NvidiaGPUDomain from pyJoules.energy_meter import EnergyMeter

domains = [RaplPackageDomain(0), RaplDramDomain(0), NvidiaGPUDomain(0)] devices = DeviceFactory.create_devices(domains) meter = EnergyMeter(devices)

meter.start(tag='foo') foo() meter.record(tag='bar') bar() meter.stop()

trace = meter.get_trace() ?

I mean how to print it?

prachikashikar avatar Jun 28 '23 05:06 prachikashikar

I filed a PR at https://github.com/backdrop/backdrop/pull/3638 that makes this change.

I couldn't see any other changes necessary to hook_cron() or hook_requirements(). Seems as though just removing hook_init() is really all that is needed here.

Testing this on a sandbox isn't very viable, you may need local testing to simulate having installed old versions of modules or core to trigger the update status requirements.

quicksketch avatar May 27 '21 04:05 quicksketch

Interesting - and sooo silent.

I tested locally by applying the patch, then installed an outdated module (webform 1.x-4.20.1), ran cron.

  • The red dot in the admin menu appeared as expected.
  • No messages at all - to be honest, that was a bit irritating. At least, unfamiliar.

Do we want Backdrop to be that silent? Or do messages on certain pages make sense (which ones)? I agree, that the current "haunting with messages throughout the admin pages" isn't the best solution, but no messages at all also feels odd - maybe just because I'm used to the "haunting" for so many years now. :grin:

BTW some related tests (that check for the messages) still need an update or removal, they're currently failing.

indigoxela avatar May 29 '21 10:05 indigoxela

No messages at all - to be honest, that was a bit irritating.

Even not in the status report? That's the place where I'd expect such messages.

olafgrabienski avatar May 31 '21 09:05 olafgrabienski

Even not in the status report?

The status page does show the pending security update, of course, but no messages above.

Here's a screenshot from the sandbox:

status-page-warning

indigoxela avatar May 31 '21 09:05 indigoxela

The status page does show the pending security update, of course, but no messages above.

Thanks for sharing the screenshot! In my opinion, the notice about the pending security update is enough.

olafgrabienski avatar May 31 '21 10:05 olafgrabienski

I could get used to this, but my issue with showing this only via the red dot in the admin bar is that the core Administration Bar module can be disabled. Admittedly, this would be an odd case, and people would most likely replace the core module with something like https://github.com/backdrop-contrib/navbar, which also supports the red dot indicator.

klonos avatar May 31 '21 11:05 klonos

I could get used to this, ...

That sounds a bit like you "could resign to it". :smirk:

I agree, having only the red dot could be a bit too silent. And the change compared to the current behavior might be too radical. Most D and B users are used to the nagging - at least, I am.

Where are those messages essential? On which pages do people expect them to appear? All admin pages? Some admin pages?

indigoxela avatar May 31 '21 11:05 indigoxela

I think this may have just become urgent. See related https://github.com/backdrop/backdrop-issues/issues/6077

jenlampton avatar Apr 22 '23 05:04 jenlampton

I don't have a site to test this on, but I think I would appreciate it if the nagging were reduced a bit. I'm sure this PR would need rebasing.

stpaultim avatar Apr 20 '24 05:04 stpaultim

Yay, one of my favorite peeves might get some traction :smile:

I rebased the PR to give it a fresh sandbox.

quicksketch avatar Apr 20 '24 08:04 quicksketch

Is there anyway to simulate a website that needs a security update in the PR sandbox, or do I really need to apply this to a local site to see the effects. @quicksketch

stpaultim avatar Apr 20 '24 19:04 stpaultim

I don't have any good suggestions there @stpaultim. You could probably use Devel module to execute PHP to download an insecure module. Backdrop doesn't provide any mechanisms for downgrading.

quicksketch avatar Apr 20 '24 19:04 quicksketch

I updated the PR to remove the test coverage for checking the messages. It's now 100% passing.

quicksketch avatar Apr 28 '24 00:04 quicksketch

I have installed and tested this on my local, and things work as expected, with the exception of a thing that is actually pre-existing. I've filed #6482 to address that separately.

The code changes look good too (code reduction++), so this is RTBC 👍🏼

klonos avatar Apr 28 '24 01:04 klonos

@indigoxela I've also raised #6483, which I think will somewhat address some of your concerns (even if partially).

klonos avatar Apr 28 '24 02:04 klonos

I merged https://github.com/backdrop/backdrop/pull/3638 into 1.x and 1.27.x. Yay, glad to see this old issue resolved. Thanks @klonos, @indigoxela (even playing the disapproving role), @stpaultim, @jenlampton, and @olafgrabienski.

quicksketch avatar Apr 29 '24 15:04 quicksketch