使用 CRON 的 volttron 调度执行器代理

时间:2021-05-14 13:52:12

标签: volttron

对于我使用 agent creation wizard 开发的 volttron 代理,我能否获得有关与此相关的错误的提示,'Timezone offset does not match system offset: -18000 != 0. Please, check your config files.'

在使用 from volttron.platform.scheduling import cron 功能测试我的脚本时,我注意到边缘设备上的时区/计算机时间已经过时,因此我使用此 tutorial 重置了时区,我认为这肯定把事情搞砸了.

ERROR: volttron.platform.jsonrpc.RemoteError: builtins.ValueError('Timezone offset does not match system offset: -18000 != 0. Please, check your config files.')

无论这是否有所不同,此边缘设备确实使用转发代理将数据推送到中央 VOLTTRON 实例。

2021-05-14 12:45:00,007 (actuatoragent-1.0 313466) volttron.platform.vip.agent.subsystems.rpc ERROR: unhandled exception in JSON-RPC method 'request_new_schedule':
Traceback (most recent call last):
  File "/var/lib/volttron/volttron/platform/vip/agent/subsystems/rpc.py", line 158, in method
    return method(*args, **kwargs)
  File "/home/volttron/.volttron/agents/8f4ee1c0-74cb-4070-8a8c-57bf9bea8a71/actuatoragent-1.0/actuator/agent.py", line 1343, in request_new_schedule
    return self._request_new_schedule(rpc_peer, task_id, priority, requests, publish_result=False)
  File "/home/volttron/.volttron/agents/8f4ee1c0-74cb-4070-8a8c-57bf9bea8a71/actuatoragent-1.0/actuator/agent.py", line 1351, in _request_new_schedule
    local_tz = get_localzone()
  File "/var/lib/volttron/env/lib/python3.8/site-packages/tzlocal/unix.py", line 165, in get_localzone
    _cache_tz = _get_localzone()
  File "/var/lib/volttron/env/lib/python3.8/site-packages/tzlocal/unix.py", line 90, in _get_localzone
    utils.assert_tz_offset(tz)
  File "/var/lib/volttron/env/lib/python3.8/site-packages/tzlocal/utils.py", line 46, in assert_tz_offset
    raise ValueError(msg)
ValueError: Timezone offset does not match system offset: -18000 != 0. Please, check your config files.

这是我下面的 raise_setpoints_up 函数,它很像 CSV 驱动程序代理代码。

def raise_setpoints_up(self):

_log.info(f'*** [Setter Agent INFO] *** -  STARTING raise_setpoints_up function!')
schedule_request = []

# create start and end timestamps
_now = get_aware_utc_now()
str_start = format_timestamp(_now)
_end = _now + td(seconds=10)
str_end = format_timestamp(_end)

# wrap the topic and timestamps up in a list and add it to the schedules list
for device in self.jci_device_map.values():
    topic = '/'.join([self.building_topic, device])
    schedule_request.append([topic, str_start, str_end])

# send the request to the actuator
result = self.vip.rpc.call('platform.actuator', 'request_new_schedule', self.core.identity, 'my_schedule', 'HIGH', schedule_request).get(timeout=4)
_log.info(f'*** [Setter Agent INFO] *** -  actuator agent scheduled sucess!')

感谢您的建议

2 个答案:

答案 0 :(得分:0)

我怀疑 tzdata 配置的时间与系统配置的时区不同,因为您手动更改了它。试试这个:

sudo dpkg-reconfigure tzdata

答案 1 :(得分:0)

使用 sudo dpkg-reconfigure tzdata 改回 UTC 时间