Skip to content

Commit

Permalink
Update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
wbjin committed Aug 25, 2024
1 parent 263dcaa commit c93ab1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion zeus/device/cpu/rapl.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def __init__(self, path: str) -> None:
except FileNotFoundError as err:
raise ZeusRAPLFileInitError("Error reading package energy") from err
except PermissionError as err:
raise ZeusRAPLPermissionError(
raise cpu_common.ZeusCPUNoPermissionError(
"Can't read file due to permission error"
) from err
try:
Expand Down
7 changes: 3 additions & 4 deletions zeus/monitor/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
from dataclasses import dataclass
from functools import cached_property

from zeus.device.cpu.rapl import ZeusRAPLPermissionError
from zeus.monitor.power import PowerMonitor
from zeus.utils.logging import get_logger
from zeus.utils.framework import sync_execution as sync_execution_fn
from zeus.device import get_gpus, get_cpus
from zeus.device.gpu.common import ZeusGPUInitError, EmptyGPUs
from zeus.device.cpu.common import ZeusCPUInitError, EmptyCPUs
from zeus.device.cpu.common import ZeusCPUInitError, ZeusCPUNoPermissionError, EmptyCPUs

logger = get_logger(__name__)

Expand Down Expand Up @@ -187,10 +186,10 @@ def __init__(
self.cpus = get_cpus()
except ZeusCPUInitError:
self.cpus = EmptyCPUs()
except ZeusRAPLPermissionError as err:
except ZeusCPUNoPermissionError as err:
if cpu_indices:
raise RuntimeError(
"SYS_ADMIN capability is required to read RAPL files. See "
"root capability is required to read RAPL files. See "
"https://ml.energy/zeus/getting_started/#system-privileges "
"for more information or disable CPU measurement by passing cpu_indices=[] to "
"ZeusMonitor"
Expand Down

0 comments on commit c93ab1f

Please sign in to comment.