Skip to content

Commit

Permalink
Merge pull request #3 from schandrika/v10
Browse files Browse the repository at this point in the history
V10
  • Loading branch information
craig8 authored Oct 1, 2024
2 parents 38761dc + 0d9082f commit 5357394
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ profile = "black"
include = ["src/sysmon", "sysmonagent.config"]

name = "volttron-sysmon"
version = "0.1.0"
version = "1.0.0"
description = ""
authors = ["VOLTTRON Team <[email protected]>"]
license = "Apache License 2.0"
Expand All @@ -32,7 +32,7 @@ classifiers = [

[tool.poetry.dependencies]
python = ">=3.10,<4.0"
volttron = "^10.0.4rc1"
volttron-core = ">=2.0.0rc0"

[tool.poetry.group.dev.dependencies]
volttron-testing = "^0.4.0rc0"
Expand Down
22 changes: 12 additions & 10 deletions src/sysmon/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
import psutil
from gevent import sleep
from volttron import utils
from volttron.client.logs import setup_logging
from volttron.client.vip.agent import RPC, Agent
from volttron.utils.scheduling import periodic

utils.setup_logging()
setup_logging()
_log = logging.getLogger(__name__)
__version__ = '4.0'

Expand Down Expand Up @@ -209,15 +210,16 @@ def on_configure(self, config_name, action, contents):
sleep(1) # Wait for a second to pass to avoid divide by zero errors from tracking variables.
for method in self.IMPLEMENTED_METHODS:
item = monitors.pop(method, None)
if method == 'path_usage_rate' and item.get('path_name', None):
# Set initial value(s) of self.last_path_sizes for any configured path names.
self.path_usage_rate(item.get('path_name'))
if item and item.pop('poll', None) is True:
item_publish_type = item.get('publish_type', None)
item_publish_type = 'record' if method in self.RECORD_ONLY_PUBLISH_METHODS else item_publish_type
item_publish_type = item_publish_type if item_publish_type else self.default_publish_type
self._periodic_pub(getattr(self, method), item_publish_type, item['check_interval'], item['point_name'],
item['params'])
if item:
if method == 'path_usage_rate' and item.get('path_name', None):
# Set initial value(s) of self.last_path_sizes for any configured path names.
self.path_usage_rate(item.get('path_name'))
if item and item.pop('poll', None) is True:
item_publish_type = item.get('publish_type', None)
item_publish_type = 'record' if method in self.RECORD_ONLY_PUBLISH_METHODS else item_publish_type
item_publish_type = item_publish_type if item_publish_type else self.default_publish_type
self._periodic_pub(getattr(self, method), item_publish_type, item['check_interval'], item['point_name'],
item['params'])

for key in contents:
_log.warning('Ignoring unrecognized configuration parameter %s', key)
Expand Down

0 comments on commit 5357394

Please sign in to comment.