mendevi.g5kpower

Integrates grid5000’s power meter.

Classes

G5kPower(*args, **kwargs)

Asynchronous consumption request on g5k.

Functions

g5kpower(hostname, start, duration, *[, ...])

Do a request to get the grid5000 consumption.

Details

class mendevi.g5kpower.G5kPower(*args, **kwargs)[source]

Asynchronous consumption request on g5k.

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is a list or tuple of arguments for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

mendevi.g5kpower.g5kpower(hostname: str, start: Real, duration: Real, *, login: str | None = None, password: str | None = None) dict[str][source]

Do a request to get the grid5000 consumption.

Parameters

hostnamestr

The hostname containing the node name and the site. It can be get with platform.node().

startfloat

The starting timestamp, it can be get by time.time().

durationfloat

The job duration in seconds.

login, pswstr

Username an password for grid5000 api.

Returns

Consumption: dict[str]
  • ‘dt’: The time difference between 2 consecutive power measurements (in s).

  • ‘energy’: The total energy consumption (in J).

  • ‘power’: The average power, energy divided by the duration (in w).

  • ‘powers’: The power measured between 2 consecutive points (in w).

Raises

ValueError

If the request failed.

Examples

>>> import platform, time
>>> from mendevi.g5kpower import g5kpower
>>> g5kpower(platform.node(), time.time()-10.0, 10.0)
>>>

Notes

  • Tested with oarsub -I -p paradoxe -t deploy -t monitor=’wattmetre_power_watt’.

  • Power and time measurements are differental to increase the compressibility of the database containing this result.

  • Energy is estimated from the trapezoidal integral of instantaneous powers.