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

V10 #3

Merged
merged 2 commits into from
Oct 1, 2024
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
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
Loading