

@wrap_exceptions
def set_process_ionice(self, ioclass, value):
    if (ioclass in (IOPRIO_CLASS_NONE, None)):
        if value:
            raise ValueError("can't specify value with IOPRIO_CLASS_NONE")
        ioclass = IOPRIO_CLASS_NONE
        value = 0
    if (ioclass in (IOPRIO_CLASS_RT, IOPRIO_CLASS_BE)):
        if (value is None):
            value = 4
    elif (ioclass == IOPRIO_CLASS_IDLE):
        if value:
            raise ValueError("can't specify value with IOPRIO_CLASS_IDLE")
        value = 0
    else:
        value = 0
    if (not (0 <= value <= 8)):
        raise ValueError('value argument range expected is between 0 and 8')
    return _psutil_linux.ioprio_set(self.pid, ioclass, value)

dataset/ETHPy150Open packages/psutil/psutil/_pslinux.py Process.set_process_ionice/original