Ejemplo n.º 1
0
def get_container(cont_name):
    try:
        global log
        log = _log.MsgLog('GrafanaViews')
        path = settings.SOS_ROOT + '/' + cont_name
        cont = Sos.Container(path)
        return cont
    except:
        cont = None
        return cont
Ejemplo n.º 2
0
import sys
import os
import datetime, time
import tempfile
import json
import urllib.parse
from sosdb import Sos
from sosgui import settings, _log

log = _log.MsgLog("sosdb_models")

sos_filt_cond = {
    "gt": Sos.COND_GT,
    "ge": Sos.COND_GE,
    "ne": Sos.COND_NE,
    "eq": Sos.COND_EQ,
    "le": Sos.COND_LE,
    "lt": Sos.COND_LT
}


def open_test(path):
    try:
        c = Sos.Container(path)
        c.close()
        return True
    except Exception as e:
        log.write('open_test err: ' + repr(e))
        return False

Ejemplo n.º 3
0
from django.db import models
import datetime as dt
import time
import os, sys, traceback
from sosdb import Sos
from sosgui import settings, _log
from numsos.DataSource import SosDataSource
from graf_analysis.grafanaAnalysis import papiAnalysis
from . import views
from numsos.Transform import Transform
from sosdb.DataSet import DataSet
import numpy as np
import pandas as pd

log = _log.MsgLog("Grafana SOS")

job_status_str = {
    1 : "running",
    2 : "complete"
}

papi_metrics = [ 
    "PAPI_TOT_INS",
    "PAPI_TOT_CYC",
    "PAPI_LD_INS",
    "PAPI_SR_INS",
    "PAPI_BR_INS",
    "PAPI_FP_OPS",
    "PAPI_L1_ICM",
    "PAPI_L1_DCM",
    "PAPI_L2_ICA",
Ejemplo n.º 4
0
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.template import Context, loader
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse, Http404
from sosgui import _log
import json
import sys

log = _log.MsgLog("job_view")


#Handles templates
@login_required
def index(request):
    try:
        return render_to_response('jobs/index.html', {})
    except Exception as e:
        log.write(e)
        raise Http404


def job_graph(request):
    try:
        return render_to_response('jobs/metric_graph.html', {})
    except Exception as e:
        log.write(e)
        raise Http404
Ejemplo n.º 5
0
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.template import Context, loader
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse, Http404
from sosgui import _log, settings
from sosgui.utils import template_render
import json
import sys

log = _log.MsgLog('container views')


#Handles templates
@login_required
def overview(request):
    return template_render('container/overview.html', request, 'Containers')
Ejemplo n.º 6
0
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.template import Context, loader
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse, Http404
from .models import SosDir, SosContainer, SosSchema, SosTable
from sosgui import _log
import json
import sys

log = _log.MsgLog("sosdb_views")


def directory(request):
    if request.user.is_authenticated:
        try:
            d = SosDir()
            d['authenticated'] = True
            d = json.dumps(d)
            return HttpResponse(d, content_type="text/json")
        except Exception as e:
            log.write(e)
            return HttpResponse('{ "directory" : [] }',
                                content_type="text/json")
    else:
        resp = {}
        resp['authenticated'] = False
        return HttpResponse(json.dumps(resp), content_type="text/json")


def container(request):
Ejemplo n.º 7
0
import traceback as tb
import datetime as dt
import _strptime
import time
import sys
from . import models_sos
import numpy as np
import importlib
import json

try:
    import models_baler
except:
    pass

log = _log.MsgLog('grafana.views: ')


def converter(obj):
    if isinstance(obj, np.integer):
        return int(obj)
    elif isinstance(obj, np.floating):
        return float(obj)
    elif isinstance(obj, np.ndarray):
        return obj.tolist()
    elif isinstance(obj, dt.datetime):
        return obj.__str__()


def get_container(cont_name):
    try:
Ejemplo n.º 8
0
import django.contrib.auth as auth
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.template import Context, loader
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse, Http404
from sosgui import _log, settings
from sosgui.utils import template_render
import json
import sys

log = _log.MsgLog("objbrowser_views")


@login_required
def index(request):
    return template_render('objbrowser/index.html', request, 'Object Browser')