def content(self): try: import uwsgi except ImportError: return render_to_string('uwsgi_admin/uwsgi_panel.html', {'unavailable': True}) workers = uwsgi.workers() total_load = time.time() - uwsgi.started_on for w in workers: w['load'] = (100 * (w['running_time'] / 1000)) / total_load w['last_spawn_str'] = time.ctime(w['last_spawn']) jobs = [] if 'spooler' in uwsgi.opt: spooler_jobs = uwsgi.spooler_jobs() for j in spooler_jobs: jobs.append({'file': j, 'env': uwsgi.parsefile(j)}) context = self.context.copy() context.update(csrf(self.request)) context.update({ 'masterpid': uwsgi.masterpid(), 'started_on': time.ctime(uwsgi.started_on), 'buffer_size': uwsgi.buffer_size, 'total_requests': uwsgi.total_requests(), 'numproc': uwsgi.numproc, 'workers': workers, 'jobs': jobs, }) return render_to_string('uwsgi_admin/uwsgi_panel.html', context)
def content(self): workers = uwsgi.workers() total_load = time.time() - uwsgi.started_on for w in workers: w["load"] = (100 * (w["running_time"] / 1000)) / total_load w["last_spawn_str"] = time.ctime(w["last_spawn"]) jobs = [] if "spooler" in uwsgi.opt: spooler_jobs = uwsgi.spooler_jobs() for j in spooler_jobs: jobs.append({"file": j, "env": uwsgi.parsefile(j)}) context = self.context.copy() context.update( { "masterpid": uwsgi.masterpid(), "started_on": time.ctime(uwsgi.started_on), "buffer_size": uwsgi.buffer_size, "total_requests": uwsgi.total_requests(), "numproc": uwsgi.numproc, "workers": workers, "jobs": jobs, } ) return render_to_string("uwsgi_admin/uwsgi_panel.html", context)
def index(request): workers = uwsgi.workers() total_load = time.time() - uwsgi.started_on for w in workers: w['load'] = (100 * (w['running_time']/1000))/total_load w['last_spawn_str'] = time.ctime(w['last_spawn']) jobs = [] if 'spooler' in uwsgi.opt: spooler_jobs = uwsgi.spooler_jobs() for j in spooler_jobs: jobs.append({'file': j, 'env': uwsgi.parsefile(j)}) return render_to_response('uwsgi.html', {'masterpid': uwsgi.masterpid(), 'started_on': time.ctime(uwsgi.started_on), 'buffer_size': uwsgi.buffer_size, 'total_requests': uwsgi.total_requests(), 'numproc': uwsgi.numproc, 'workers': workers, 'jobs': jobs, }, RequestContext(request, {}))
def index(request): try: import uwsgi except ImportError: return render(request, 'uwsgi_admin/uwsgi.html', { 'unavailable': True }) workers = uwsgi.workers() total_load = time.time() - uwsgi.started_on for w in workers: w['running_time'] = w['running_time'] / 1000 w['load'] = w['running_time'] / total_load / 10 / len(workers) w['last_spawn'] = datetime.fromtimestamp(w['last_spawn']) jobs = [] if 'spooler' in uwsgi.opt: spooler_jobs = uwsgi.spooler_jobs() for j in spooler_jobs: jobs.append({'file': j, 'env': uwsgi.parsefile(j)}) return render(request, 'uwsgi_admin/uwsgi.html', { 'masterpid': uwsgi.masterpid(), 'stats': [ ('masterpid', str(uwsgi.masterpid())), ('started_on', datetime.fromtimestamp(uwsgi.started_on)), ('now', datetime.now()), ('buffer_size', uwsgi.buffer_size), ('total_requests', uwsgi.total_requests()), ('numproc', uwsgi.numproc), ('cores', uwsgi.cores), ('spooler pid', uwsgi.spooler_pid() if uwsgi.opt.get('spooler') else 'disabled'), ('threads', 'enabled' if uwsgi.has_threads else 'disabled') ], 'options': uwsgi.opt.items(), 'workers': workers, 'jobs': jobs, })
def index(request): try: import uwsgi except ImportError: return render(request, 'uwsgi_admin/uwsgi.html', {'unavailable': True}) workers = uwsgi.workers() total_load = time.time() - uwsgi.started_on for w in workers: w['running_time'] = w['running_time'] / 1000 w['load'] = w['running_time'] / total_load / 10 / len(workers) w['last_spawn'] = datetime.fromtimestamp(w['last_spawn']) jobs = [] if 'spooler' in uwsgi.opt: spooler_jobs = uwsgi.spooler_jobs() for j in spooler_jobs: jobs.append({'file': j, 'env': uwsgi.parsefile(j)}) return render( request, 'uwsgi_admin/uwsgi.html', { 'masterpid': uwsgi.masterpid(), 'stats': [('masterpid', str(uwsgi.masterpid())), ('started_on', datetime.fromtimestamp(uwsgi.started_on)), ('now', datetime.now()), ('buffer_size', uwsgi.buffer_size), ('total_requests', uwsgi.total_requests()), ('numproc', uwsgi.numproc), ('cores', uwsgi.cores), ('spooler pid', uwsgi.spooler_pid() if uwsgi.opt.get('spooler') else 'disabled'), ('threads', 'enabled' if uwsgi.has_threads else 'disabled')], 'options': uwsgi.opt.items(), 'workers': workers, 'jobs': jobs, })
def taskParameters(filepath): # Retrieve parameters return uwsgi.parsefile(filepath)