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


Python CloudHost.should_accept_session方法代碼示例

本文整理匯總了Python中cloud.aws.CloudHost.should_accept_session方法的典型用法代碼示例。如果您正苦於以下問題:Python CloudHost.should_accept_session方法的具體用法?Python CloudHost.should_accept_session怎麽用?Python CloudHost.should_accept_session使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cloud.aws.CloudHost的用法示例。


在下文中一共展示了CloudHost.should_accept_session方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: try_launch_container

# 需要導入模塊: from cloud.aws import CloudHost [as 別名]
# 或者: from cloud.aws.CloudHost import should_accept_session [as 別名]
    def try_launch_container(cls, user_id):
        sessname = unique_sessname(user_id)
        cont = JBoxContainer.get_by_name(sessname)
        cls.log_debug("have existing container for %s: %r", sessname, None != cont)
        if cont is not None:
            cls.log_debug("container running: %r", cont.is_running())

        if ((cont is None) or (not cont.is_running())) and (not CloudHost.should_accept_session()):
            if cont is not None:
                cont.async_backup_and_cleanup()
            return False

        JBoxContainer.async_launch_by_name(sessname, user_id, True)
        return True
開發者ID:melvin0008,項目名稱:JuliaBox,代碼行數:16,代碼來源:handler_base.py

示例2: try_launch_container

# 需要導入模塊: from cloud.aws import CloudHost [as 別名]
# 或者: from cloud.aws.CloudHost import should_accept_session [as 別名]
    def try_launch_container(cls, user_id, max_hop=False):
        sessname = unique_sessname(user_id)
        cont = JBoxContainer.get_by_name(sessname)
        cls.log_debug("have existing container for %s: %r", sessname, None != cont)
        if cont is not None:
            cls.log_debug("container running: %r", cont.is_running())

        if max_hop:
            self_load = CloudHost.get_instance_stats(CloudHost.instance_id(), 'Load')
            if self_load < 100:
                JBoxContainer.async_launch_by_name(sessname, user_id, True)
                return True

        is_leader = is_proposed_cluster_leader()
        if ((cont is None) or (not cont.is_running())) and (not CloudHost.should_accept_session(is_leader)):
            if cont is not None:
                cont.async_backup_and_cleanup()
            return False

        JBoxContainer.async_launch_by_name(sessname, user_id, True)
        return True
開發者ID:barrygolden,項目名稱:JuliaBox,代碼行數:23,代碼來源:handler_base.py


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