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


Python HqDeploy.get_latest方法代碼示例

本文整理匯總了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
開發者ID:dimagi,項目名稱:commcare-hq,代碼行數:27,代碼來源:system.py

示例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
開發者ID:kennknowles,項目名稱:commcare-hq,代碼行數:54,代碼來源:views.py

示例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)
開發者ID:ekush,項目名稱:commcare-hq,代碼行數:23,代碼來源:views.py

示例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)
開發者ID:pawelreise,項目名稱:commcare-hq,代碼行數:26,代碼來源:views.py

示例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)
開發者ID:nikhilvarma22,項目名稱:commcare-hq,代碼行數:32,代碼來源:views.py

示例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)
開發者ID:tsinkala,項目名稱:core-hq,代碼行數:33,代碼來源:views.py


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