iRiser API

Riser

Primary interface for iRiser hardware. Wraps the iRiser CLI.

class Riser(slot, check_hardware=False)

iRiser object. Contains relevant attributes for understanding the current state of the riser.

Parameters:
  • slot (int) – iRiser slot number. Valid values are 0 - 18 on a ‘RM’ and 0-4 on ‘DT’

  • check_hardware (bool) – If True, call _is_supported() during construction and skip when no iRiser is present on the slot.

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(1)
init(log=True) dict

Reset GPIO to default values, stop the sequencer and clear memory sequence.

Sets module back to initialized state, PCIe switches will be Closed, all signals will be in operational state

Returns:

dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.init()
iRiser -d ... init
{'status': 0, 'result': 'INFO: ...
reset(log=True) dict

Stop the sequencer reset GPIO to defaults

Returns:

dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.reset()
iRiser -d ... reset
{'status': 0, 'result': 'INFO: ...
set(sig, log=True)

Assert a signal immediately (no sequencer).

Wraps iRiser -d <slot> set <SIG>. The signal name is passed to the CLI in uppercase. Use clear() to deassert.

Returns:

status (0 on success), result (CLI output, e.g. pin direction/value), and reason (stderr when non-zero).

Return type:

dict

Example

>>> from sanblaze import riser
>>> r = riser.Riser(0)
>>> r.set('12VEDSF')
...
clear(sig, log=True)

Deassert a signal immediately (no sequencer).

Wraps iRiser -d <slot> clear <SIG>. The signal name is passed to the CLI in uppercase. Use set() to assert.

Returns:

status (0 on success), result (CLI output, e.g. pin direction/value), and reason (stderr when non-zero).

Return type:

dict

Example

>>> from sanblaze import riser
>>> r = riser.Riser(0)
>>> r.clear('12VEDSF')
...
get_bits(raw=False, log=True)

Get info about the signals on the current iRiser

Returns:

signal names with their values

Return type:

dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_bits()
iRiser ...
get_actions(raw=False, log=True) [<class 'sanblaze.system.iRiser.action.Action'>]

Get the actions currently programed on the gpio

Returns:

status actions

Return type:

dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_actions()
iRiser ...
get_state(raw=False, log=True)

The current state of the iRiser. If the device has just been initialized the state is None. Otherwise, valid states are ‘stopped’, and ‘running’

Parameters:
  • raw (bool) – If set to True, returns a string representing the state. If set to false, returns the value in a status dictionary.

  • log (bool)

Return type:

str or dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_state()
iRiser -d 1 status -J
{'status': 0, 'state': 'stopped'}
>>> r.get_state(raw=True)
iRiser -d 1 status -J
'stopped'
>>>
get_action(raw=False, log=True)

The current action of the iRiser. If the device has just been initialized the action is None. Otherwise, valid actions are integers 0 to 127’

Parameters:

raw (bool) – If set to True, returns an integer representing the current action. If set to false, returns the value in a status dictionary.

Return type:

int or dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_action()
iRiser -d 1 status -J
{'status': 0, 'action': ...}
>>> r.get_action(raw=True)
iRiser -d 1 status -J
get_sequence(raw=False)

The current sequence of the iRiser. If the device has just been initialized the sequence is None. Otherwise, valid sequences are integers 0 to 127’

Parameters:

raw (bool) – If set to True, returns an integer representing the current sequence. If set to false, returns the value in a status dictionary.

Return type:

int or dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_sequence()
iRiser -d ... status -J
{'status': 0, 'sequence': ...}
>>> r.get_sequence(raw=True)
iRiser -d ... status -J
>>>
get_status(log=True, raw=False)

The current status of the iRiser.

Return type:

int or dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_status()
iRiser -d 1 status -J
{'status': 0, 'sequencer': 'stopped', 'sequence': ...
get_sequences(log=True, raw=False) [<class 'sanblaze.system.iRiser.sequence.Sequence'>]

Get the sequences currently programed on the gpio.

Returns:

sequence objects

Return type:

dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_sequences()
iRiser ...
get_gpio(log=True) dict

Return all information from a gpio query

Return type:

dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_gpio()
iRiser -d 1 show gpio -J
{'status': 0, 'bits': ... 'gpio': '0'}
get_power(log=True, raw=False)

Get power measured by iRiser

Return type:

dict

Example

>>> from sanblaze import riser
>>> slot = 1
>>> r = riser.Riser(slot)
>>> r.get_power()
iRiser -d 1 show power
{'status': 0, 'power': ..., 'units': 'Watts'}
copy_action(num, dest)

Copy an action from an existing action number to a new action number

edit_action(dest, dir, val, time, units, _next, log=True)

Edit an iRiser action

start_sequence(num, log=True)

Start a sequence by sequence number

Returns:

status

Return type:

dict

compare_power_available(power_devices: list, log=False)

Verify requested power rails are available on this iRiser slot.

All devices in power_devices must be reported by get_power_available(). Returns the confirmed list on success.

Rail names include: 12Vp, 3.3Vp, 3.3Vpa, 1.8Vpa, 12V, 3.3V

start_collect_power(dir_name: str, samples: str, duration=None, count=None, power_devices=None, log=True)

Starts the DMA engine to collect power data Samples can be taken as fast as 1M samples/second

iRiser -d <slot> start power <recording> <0|12V> <samples> <duration>

Parameters:
  • dir_name (str) – Name of the directory which will contain the recorded power measurements for the devices specified If it’s the same as a previous recording, it’ll overwrite the previous recording. Example: ‘testdirectory’

  • samples (str) – This is the sample rate, can be specified as an actual sample time (1mS, 100uS, 1s) Example: ‘10000us’ (100 samples per second)

  • duration (str) – time the monitoring will execute for. The value can be specified in seconds (i.e 5s), milliseconds (i.e 10ms) or microseconds (i.e. 600us) Example: ‘5s’

  • count (int) – The value corresponds to the number of records to collect

  • power_devices – If None, it will use all available power devices. 12Vp - EDSFF 12.0V 20bit AtoD (highest precision) (iRiser5+) 3.3Vp - EDSFF 3.3VAux 20bit AtoD (highest precision) (iRiser5+) 3.3Vpa - M.2 3.3V 20bit AtoD (highest precision) (iRiser5+) 1.8Vpa - M.2 1.8V 20bit AtoD (highest precision) (iRiser5+) 12V - EDSFF 12.0V 12bit (highest speed) iRiser5 (iRiser5) 3.3V - EDSFF 3.3VAux 12bit (highest speed) (iRiser5+) all - All devices which can be monitored based on configuration Note: E1.S and E1.L are form factors of EDSFF. (S = Short, L = Long, 1 is the 1u Server) Note: 12Vp and 3.3Vp are the precise measuring, while 12V and 3.3V are the speed measuring.

Example

iRiser -d <slot> start power <directoryName> <powerDevice> <sampleFrequency> <duration> iRiser -d 1 start power testcapture 12Vp,3.3Vp 10us 5000s

get_power_available(log=True)

Get the available power devices. There’s 6 different ones, but each device usually has 2 available.

verify_service_status(log=True)

If ServiceRunning=1, it’s running. If ServiceRunning=0, Need to run the “systemctl start iriser” command in order to start the service

get_all_data_chunk(dir_name, power_device, start, end, log=False)

Retrieve all power measurement data for the specified power device as 10M chunk dataset

Parameters:
  • dir_name – The directory name and power device are the same as those used to start the recording. If None: Determine available records to view

  • power_device – 12Vp - EDSFF 12.0V 20bit AtoD (highest precision) (iRiser5+) 3.3Vp - EDSFF 3.3VAux 20bit AtoD (highest precision) (iRiser5+) 3.3Vpa - M.2 3.3V 20bit AtoD (highest precision) (iRiser5+) 1.8Vpa - M.2 1.8V 20bit AtoD (highest precision) (iRiser5+) 12V - EDSFF 12.0V 12bit (highest speed) iRiser5 (iRiser5) 3.3V - EDSFF 3.3VAux 12bit (highest speed) (iRiser5+) all - All devices which can be monitored based on configuration Note: E1.S and E1.L are form factors of EDSFF. (S = Short, L = Long, 1 is the 1u Server) Note: 0 and 1 are the precise measuring, while 4 and 5 are the speed measuring.

  • start – The starting sample index (0 base)

  • end – The ending sample index (0 base)

Return type:

result dict with a 1D Numpy array of power data values

get_sliding_window_max(data, window_size)

Compute the maximum raw power value inside every sliding window using a deque.

Parameters:
  • data – 1D numpy array samples.

  • window_size (int) – Number of samples per window

Return type:

a 1D Numpy array of maximum value from each window

get_sliding_window_sum(data, window_size)

Compute the total power (sum) for each sliding window using a deque

Parameters:
  • data – 1D numpy array samples.

  • window_size (int) – Number of samples per window

Return type:

a 1D Numpy array of maximum value from each window

create_sequence(start=0, sequence=None)

Prepare to program actions beginning at index start.

This sets Python-side state only; it does not configure the iRiser sequence table on the device. Use the same number in start_sequence() unless sequence is supplied explicitly.

add_transition(group, state, delay, final=False)

Program an action that toggles one or more GPIO signals after a delay.

Parameters:
  • group (str or list) – Signal name(s) to change, for example 'perst0l' or ['12v', 'p0clkl'].

  • state (str) – 'on' to set the signal bit, 'off' to clear it.

  • delay (str) – Hold time before advancing, for example '1s' or '50ms'.

  • final (bool) – When True, set the action’s next pointer to stop instead of chaining to the next action index.

Bits

Aggregated GPIO state returned by get_bits() when raw=True.

class Bits(bits)
class Bit(_dict)

Fundamental unit of a iRiser GPIO

Action

A single sequencer action parsed from iRiser show actions -J output.

class Action(_dict)

An action of an iRiser Sequence. Composed of a Bits objects with time and next

Sequence

A sequencer sequence parsed from iRiser show sequences -J output.

class Sequence(_dict, actions)

An iRiser sequence