本文整理汇总了Python中corehq.apps.hqadmin.models.HqDeploy.get_latest方法的典型用法代码示例。如果您正苦于以下问题:Python HqDeploy.get_latest方法的具体用法?Python HqDeploy.get_latest怎么用?Python HqDeploy.get_latest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.hqadmin.models.HqDeploy
的用法示例。
在下文中一共展示了HqDeploy.get_latest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: page_context
# 需要导入模块: from corehq.apps.hqadmin.models import HqDeploy [as 别名]
# 或者: from corehq.apps.hqadmin.models.HqDeploy import get_latest [as 别名]
def page_context(self):
environment = settings.SERVER_ENVIRONMENT
context = get_hqadmin_base_context(self.request)
context['couch_update'] = self.request.GET.get('couch_update', 5000)
context['celery_update'] = self.request.GET.get('celery_update', 10000)
context['db_update'] = self.request.GET.get('db_update', 30000)
context['self.request'] = getattr(settings, 'CELERY_FLOWER_URL', None)
context['is_bigcouch'] = is_bigcouch()
context['rabbitmq_url'] = get_rabbitmq_management_url()
context['hide_filters'] = True
context['current_system'] = socket.gethostname()
context['deploy_history'] = HqDeploy.get_latest(environment, limit=5)
context['user_is_support'] = hasattr(self.request, 'user') and SUPPORT.enabled(self.request.user.username)
context['redis'] = service_checks.check_redis()
context['rabbitmq'] = service_checks.check_rabbitmq()
context['celery_stats'] = get_celery_stats()
context['heartbeat'] = service_checks.check_heartbeat()
context['cluster_health'] = escheck.check_es_cluster_health()
return context
示例2: system_info
# 需要导入模块: from corehq.apps.hqadmin.models import HqDeploy [as 别名]
# 或者: from corehq.apps.hqadmin.models.HqDeploy import get_latest [as 别名]
def system_info(request):
def human_bytes(bytes):
#source: https://github.com/bartTC/django-memcache-status
bytes = float(bytes)
if bytes >= 1073741824:
gigabytes = bytes / 1073741824
size = '%.2fGB' % gigabytes
elif bytes >= 1048576:
megabytes = bytes / 1048576
size = '%.2fMB' % megabytes
elif bytes >= 1024:
kilobytes = bytes / 1024
size = '%.2fKB' % kilobytes
else:
size = '%.2fB' % bytes
return size
context = get_hqadmin_base_context(request)
context['couch_update'] = request.GET.get('couch_update', 5000)
context['celery_update'] = request.GET.get('celery_update', 10000)
context['celery_flower_url'] = getattr(settings, 'CELERY_FLOWER_URL', None)
# recent changes
recent_changes = int(request.GET.get('changes', 50))
context['recent_changes'] = get_recent_changes(get_db(), recent_changes)
context['rabbitmq_url'] = get_rabbitmq_management_url()
context['hide_filters'] = True
context['current_system'] = socket.gethostname()
environment = settings.SERVER_ENVIRONMENT
context['last_deploy'] = HqDeploy.get_latest(environment)
context['snapshot'] = context['last_deploy'].code_snapshot if context['last_deploy'] else {}
#redis status
redis_status = ""
redis_results = ""
if 'redis' in settings.CACHES:
rc = cache.get_cache('redis')
try:
import redis
redis_api = redis.StrictRedis.from_url('redis://%s' % rc._server)
info_dict = redis_api.info()
redis_status = "Online"
redis_results = "Used Memory: %s" % info_dict['used_memory_human']
except Exception, ex:
redis_status = "Offline"
redis_results = "Redis connection error: %s" % ex
示例3: system_info
# 需要导入模块: from corehq.apps.hqadmin.models import HqDeploy [as 别名]
# 或者: from corehq.apps.hqadmin.models.HqDeploy import get_latest [as 别名]
def system_info(request):
environment = settings.SERVER_ENVIRONMENT
context = get_hqadmin_base_context(request)
context['couch_update'] = request.GET.get('couch_update', 5000)
context['celery_update'] = request.GET.get('celery_update', 10000)
context['db_update'] = request.GET.get('db_update', 30000)
context['celery_flower_url'] = getattr(settings, 'CELERY_FLOWER_URL', None)
context['is_bigcouch'] = is_bigcouch()
context['rabbitmq_url'] = get_rabbitmq_management_url()
context['hide_filters'] = True
context['current_system'] = socket.gethostname()
context['deploy_history'] = HqDeploy.get_latest(environment, limit=5)
context.update(check_redis())
context.update(check_rabbitmq())
context.update(check_celery_health())
context.update(check_es_cluster_health())
return render(request, "hqadmin/system_info.html", context)
示例4: system_info
# 需要导入模块: from corehq.apps.hqadmin.models import HqDeploy [as 别名]
# 或者: from corehq.apps.hqadmin.models.HqDeploy import get_latest [as 别名]
def system_info(request):
environment = settings.SERVER_ENVIRONMENT
context = get_hqadmin_base_context(request)
context['couch_update'] = request.GET.get('couch_update', 5000)
context['celery_update'] = request.GET.get('celery_update', 10000)
context['celery_flower_url'] = getattr(settings, 'CELERY_FLOWER_URL', None)
# recent changes
recent_changes = int(request.GET.get('changes', 50))
context['recent_changes'] = get_recent_changes(get_db(), recent_changes)
context['rabbitmq_url'] = get_rabbitmq_management_url()
context['hide_filters'] = True
context['current_system'] = socket.gethostname()
context['last_deploy'] = HqDeploy.get_latest(environment)
context['snapshot'] = context['last_deploy'].code_snapshot if context['last_deploy'] else {}
context.update(check_redis())
context.update(check_rabbitmq())
context.update(check_celery_health())
context.update(check_memcached())
context.update(check_es_cluster_health())
return render(request, "hqadmin/system_info.html", context)
示例5: len
# 需要导入模块: from corehq.apps.hqadmin.models import HqDeploy [as 别名]
# 或者: from corehq.apps.hqadmin.models.HqDeploy import get_latest [as 别名]
mc_stats = mc._cache.get_stats()
if len(mc_stats) > 0:
mc_status = "Online"
stats_dict = mc_stats[0][1]
bytes = stats_dict["bytes"]
max_bytes = stats_dict["limit_maxbytes"]
curr_items = stats_dict["curr_items"]
mc_results = "%s Items %s out of %s" % (curr_items, human_bytes(bytes), human_bytes(max_bytes))
except Exception, ex:
mc_status = "Offline"
mc_results = "%s" % ex
context["memcached_status"] = mc_status
context["memcached_results"] = mc_results
context["last_deploy"] = HqDeploy.get_latest()
# elasticsearch status
# node status
context.update(check_cluster_health())
context.update(check_case_index())
context.update(check_xform_index())
context.update(check_exchange_index())
return render(request, "hqadmin/system_info.html", context)
@require_superuser
def noneulized_users(request, template="hqadmin/noneulized_users.html"):
context = get_hqadmin_base_context(request)
示例6: len
# 需要导入模块: from corehq.apps.hqadmin.models import HqDeploy [as 别名]
# 或者: from corehq.apps.hqadmin.models.HqDeploy import get_latest [as 别名]
if len(mc_stats) > 0:
mc_status = "Online"
stats_dict = mc_stats[0][1]
bytes = stats_dict['bytes']
max_bytes = stats_dict['limit_maxbytes']
curr_items = stats_dict['curr_items']
mc_results = "%s Items %s out of %s" % (curr_items, human_bytes(bytes),
human_bytes(max_bytes))
except Exception, ex:
mc_status = "Offline"
mc_results = "%s" % ex
context['memcached_status'] = mc_status
context['memcached_results'] = mc_results
context['last_deploy'] = HqDeploy.get_latest()
#elasticsearch status
#node status
context.update(check_cluster_health())
context.update(check_case_index())
context.update(check_xform_index())
context.update(check_exchange_index())
return render(request, "hqadmin/system_info.html", context)
@require_superuser
def noneulized_users(request, template="hqadmin/noneulized_users.html"):
context = get_hqadmin_base_context(request)
days = request.GET.get("days", None)