當前位置: 首頁>>代碼示例>>Python>>正文


Python NetworkUtil.serialize_pnode方法代碼示例

本文整理匯總了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
開發者ID:jdosher,項目名稱:coi-services,代碼行數:39,代碼來源:rsn_platform_driver.py


注:本文中的ion.agents.platform.util.network_util.NetworkUtil.serialize_pnode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。