Skip to content

Commit

Permalink
psutil as base requirement (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raalsky authored Sep 7, 2021
1 parent 9a08513 commit e904147
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## neptune-client 0.10.9 [UNRELEASED]

### Features
- Added psutil as a base requirement ([#675](https://github.com/neptune-ai/neptune-client/pull/675))
- Added capture_traceback in neptune.init() ([#676](https://github.com/neptune-ai/neptune-client/pull/676))

## neptune-client 0.10.8
Expand Down
6 changes: 1 addition & 5 deletions neptune/internal/execution/execution_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from neptune.internal.channels.channels import ChannelNamespace
from neptune.internal.hardware.gauges.gauge_mode import GaugeMode
from neptune.internal.hardware.metrics.service.metric_service_factory import MetricServiceFactory
from neptune.internal.hardware.system.system_monitor import SystemMonitor
from neptune.internal.streams.channel_writer import ChannelWriter
from neptune.internal.streams.stdstream_uploader import StdOutWithUpload, StdErrWithUpload
from neptune.internal.threads.aborting_thread import AbortingThread
Expand Down Expand Up @@ -87,10 +86,7 @@ def start(self,
self._run_monitoring_thread()

if send_hardware_metrics:
if SystemMonitor.requirements_installed():
self._run_hardware_metrics_reporting_thread()
else:
_logger.warning('psutil is not installed. Hardware metrics will not be collected.')
self._run_hardware_metrics_reporting_thread()

def stop(self):
if self._ping_thread:
Expand Down
4 changes: 0 additions & 4 deletions neptune/internal/hardware/system/system_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@


class SystemMonitor(object):
@staticmethod
def requirements_installed():
return PSUTIL_INSTALLED

@staticmethod
def cpu_count():
return psutil.cpu_count()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,7 @@ def __init__(self, period: float = 10, attribute_namespace: str = "monitoring"):
self._gauges_in_resource: Dict[str, int] = dict()
self._attribute_namespace = attribute_namespace

@staticmethod
def _requirements_installed() -> bool:
return SystemMonitor.requirements_installed()

def start(self, run: 'Run'):
if not self._requirements_installed():
_logger.warning('psutil is not installed. Hardware metrics will not be collected.')
return

gauge_mode = GaugeMode.CGROUP if in_docker() else GaugeMode.SYSTEM
system_resource_info = SystemResourceInfoFactory(
system_monitor=SystemMonitor(), gpu_monitor=GPUMonitor(), os_environ=os.environ
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ GitPython>=2.0.8
packaging
urllib3
dataclasses>=0.6; python_version<"3.7"
psutil

0 comments on commit e904147

Please sign in to comment.