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

Actuator and driver agent fixes #3170

Merged
merged 6 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 1 addition & 4 deletions services/core/ActuatorAgent/actuator/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,11 +1382,8 @@ def _request_new_schedule(self, sender, task_id, priority, requests, publish_res
'data': {'agentID': sender,
'taskID': task_id}})

# If we are successful we do something else with the real result data
data = result.data if not result.success else {}

results = {'result': success,
'data': data,
'data': result.data,
'info': result.info_string}

if publish_result:
Expand Down
13 changes: 8 additions & 5 deletions services/core/ActuatorAgent/actuator/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
#
# ===----------------------------------------------------------------------===
# }}}


import bisect
import logging
from pickle import dumps, loads

from base64 import b64encode
from collections import defaultdict, namedtuple
from copy import deepcopy
from datetime import timedelta
from pickle import dumps, loads

from volttron.platform.agent import utils

Expand Down Expand Up @@ -340,7 +340,7 @@ def save_state(self, now):

try:
self._cleanup(now)
self.save_state_callback(dumps(self.tasks))
self.save_state_callback(b64encode(dumps(self.tasks)).decode("utf-8"))
except Exception:
_log.error('Failed to save scheduler state!')

Expand Down Expand Up @@ -411,7 +411,10 @@ def request_slots(self, agent_id, id_, requests, priority, now=None):

self.save_state(now)

return RequestResult(True, preempted_tasks, '')
if preempted_tasks:
return RequestResult(True, list(preempted_tasks), 'TASK_WERE_PREEMPTED')
else:
return RequestResult(True, {}, '')

def cancel_task(self, agent_id, task_id, now):
if task_id not in self.tasks:
Expand Down
5 changes: 4 additions & 1 deletion services/core/PlatformDriverAgent/platform_driver/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,10 @@ def heart_beat(self):
"""
_log.debug("sending heartbeat")
for device in self.instances.values():
device.heart_beat()
try:
device.heart_beat()
except (Exception, gevent.Timeout) as e:
_log.warning(f'Failed to set heart_beat point on device: {device.device_name} -- {e}.')

@RPC.export
def revert_point(self, path, point_name, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# ===----------------------------------------------------------------------===
# }}}


import gevent
import logging
from datetime import datetime, timedelta

Expand Down Expand Up @@ -98,9 +98,8 @@ def ping_target(self):
pinged = True
except errors.Unreachable:
_log.warning("Unable to reach BACnet proxy.")

except errors.VIPError:
_log.warning("Error trying to ping device.")
except (Exception, gevent.Timeout) as e:
_log.warning(f"Error trying to ping device: {e}")
davidraker marked this conversation as resolved.
Show resolved Hide resolved

self.scheduled_ping = None

Expand Down
Loading