本文整理汇总了Python中juliabox.interactive.SessContainer.maintain方法的典型用法代码示例。如果您正苦于以下问题:Python SessContainer.maintain方法的具体用法?Python SessContainer.maintain怎么用?Python SessContainer.maintain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类juliabox.interactive.SessContainer
的用法示例。
在下文中一共展示了SessContainer.maintain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_housekeeping
# 需要导入模块: from juliabox.interactive import SessContainer [as 别名]
# 或者: from juliabox.interactive.SessContainer import maintain [as 别名]
def do_housekeeping():
terminating = False
server_delete_timeout = JBoxCfg.get('interactive.expire')
inactive_timeout = JBoxCfg.get('interactive.inactivity_timeout')
SessContainer.maintain(max_timeout=server_delete_timeout, inactive_timeout=inactive_timeout)
is_leader = is_cluster_leader()
if is_leader:
terminating = False
else:
try:
terminating = JBoxAsyncJob.sync_is_terminating()
if terminating['code'] == 0:
terminating = terminating['data']
else:
JBox.log_error("Error checking if instance is terminating. Assuming False.")
terminating = False
except:
JBox.log_error("Exception checking if instance is terminating. Assuming False.")
terminating = False
if is_leader:
JBox.log_info("I am the cluster leader")
JBox.update_juliabox_status()
JBox.monitor_registrations()
if not JBoxDynConfig.is_stat_collected_within(Compute.get_install_id(), 1):
JBoxAsyncJob.async_collect_stats()
if terminating:
JBox.log_warn("terminating to scale down")
else:
JBox.do_update_user_home_image()
JBoxAsyncJob.async_plugin_maintenance(is_leader)