def dashboard(request): dbsession = DBSession() jobs = Job.get_last() running_jobs = Job.get_running() upcoming_jobs = Job.get_upcoming() # statistics num_clients = dbsession.query(count(Client.clientid)).scalar() num_jobs = dbsession.query(count(Job.jobid)).scalar() num_volumes = dbsession.query(count(Media.mediaid)).scalar() sum_volumes = Media.format_byte_size(dbsession.query(sum(Media.volbytes)).scalar() or 0) database_size = get_database_size(DBSession.bind) return locals()
def dashboard(request): dbsession = DBSession() jobs = Job.get_last() running_jobs = Job.get_running() upcoming_jobs = Job.get_upcoming() try: director_version = '<span title="Connected to" class="label label-success">%s</span>' % BConsole().get_version() except DirectorNotRunning: director_version = '<span class="label label-important">Director not running!</span>' # statistics num_clients = dbsession.query(count(Client.clientid)).scalar() num_jobs = dbsession.query(count(Job.jobid)).scalar() num_volumes = dbsession.query(count(Media.mediaid)).scalar() sum_volumes = Media.format_byte_size(dbsession.query(sum(Media.volbytes)).scalar() or 0) database_size = get_database_size(DBSession.bind) return locals()