本文整理汇总了Python中ion.agents.platform.util.network_util.NetworkUtil.serialize_pnode方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkUtil.serialize_pnode方法的具体用法?Python NetworkUtil.serialize_pnode怎么用?Python NetworkUtil.serialize_pnode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ion.agents.platform.util.network_util.NetworkUtil
的用法示例。
在下文中一共展示了NetworkUtil.serialize_pnode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _check_sync
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import serialize_pnode [as 别名]
def _check_sync(self):
"""
This will be the main operation related with checking that the
information on this platform agent (and sub-platforms) is consistent
with the information in the external network rooted at the
corresponding platform, then publishing relevant notification events.
For the moment, it only reports the value of the external checksum
and the value of the local checksum.
@todo complete implementation
@return {'external_checksum': string, 'local_checksum': string}
"""
log.debug("%r: _check_sync: getting external checksum...", self._platform_id)
external_checksum = self.get_external_checksum()
local_checksum = self._pnode.compute_checksum()
if log.isEnabledFor(logging.DEBUG): # pragma: no cover
filename = "logs/checksum_check_from_driver.yml"
try:
from ion.agents.platform.util.network_util import NetworkUtil
open(filename, "w").write(NetworkUtil.serialize_pnode(self._pnode))
except Exception as e:
log.debug("%r: cannot write %s: %s", self._platform_id, filename, e)
result = {'external_checksum': external_checksum,
'local_checksum': local_checksum}
log.debug("%r: _check_sync: result: %s", self._platform_id, result)
# TODO - if checksums are different, determine what sub-components are
# in disagreement; publish relevant event(s), etc.
return result