Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psutil as base requirement #675

Merged
merged 8 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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