本文整理匯總了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)