示例#1
0
    def handle(self, *args, **options):
        stats = statistics.get_astakos_stats()
        unit_style = options["unit_style"]
        common.check_style(unit_style)

        output_format = options["output_format"]
        if output_format == "json":
            self.stdout.write(json.dumps(stats, indent=4) + "\n")
        elif output_format == "pretty":
            pretty_print_stats(stats, unit_style, self.stdout)
        else:
            raise CommandError("Output format '%s' not supported." %
                               output_format)
示例#2
0
def stats_component_details(request, component):
    """Mirror detailed stats view for cyclades/astakos.

    This stats view will import the get_astakos/cyclades_stats function and
    return its results to the caller.
    """
    admin_log(request, component=component)
    data = {}
    status = 200
    if component == 'astakos':
        data = astakos_stats.get_astakos_stats()
    elif component == 'cyclades':
        data = cyclades_stats.get_cyclades_stats()
    else:
        status = 404
    return HttpResponse(json.dumps(data, cls=DjangoJSONEncoder),
                        mimetype=JSON_MIMETYPE, status=status)
示例#3
0
def stats_component_details(request, component):
    """Mirror detailed stats view for cyclades/astakos.

    This stats view will import the get_astakos/cyclades_stats function and
    return its results to the caller.
    """
    admin_log(request, component=component)
    data = {}
    status = 200
    if component == 'astakos':
        data = astakos_stats.get_astakos_stats()
    elif component == 'cyclades':
        data = cyclades_stats.get_cyclades_stats()
    else:
        status = 404
    return HttpResponse(json.dumps(data, cls=DjangoJSONEncoder),
                        mimetype=JSON_MIMETYPE, status=status)
示例#4
0
文件: views.py 项目: grnet/synnefo
def get_astakos_stats(request):
    _stats = stats.get_astakos_stats()
    data = json.dumps(_stats)
    return http.HttpResponse(data, status=200, content_type='application/json')
示例#5
0
def get_astakos_stats(request):
    _stats = stats.get_astakos_stats()
    data = json.dumps(_stats)
    return http.HttpResponse(data, status=200, content_type='application/json')