コード例 #1
0
def info():
    if not have_uwsgi:
        return "you aren't running web2py with uwsgi"
    info = Storage()
    info.masterpid = uwsgi.masterpid()
    info.version = uwsgi.version
    info.started_on = time.ctime(uwsgi.started_on)
    info.buffer_size = uwsgi.buffer_size
    info.total_requests = uwsgi.total_requests()
    info.logsize = uwsgi.logsize()
    info.numproc = uwsgi.numproc
    try:
        info.mode = uwsgi.mode
    except:
        pass
    try:
        info.pidfile = uwsgi.pidfile
    except:
        pass
    
    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'])
        w['vsz_str'] = do_filesizeformat(w['vsz'])
        w['rss_str'] = do_filesizeformat(w['rss'])
    
    context = dict(info=info, workers=workers)
    template = template_view('info')
    return response.render(template, context)
コード例 #2
0
ファイル: testapp.py プロジェクト: thomasgoirand/uwsgi
def reload(env, start_response):

    start_response('200 OK', [('Content-Type', 'text/html')])

    #uwsgi.sorry_i_need_to_block()
    #time.sleep(1)

    #uwsgi.reload()

#    print(str(uwsgi.masterpid()) + "\n")

#    print("i am python")
    #yo()

#    yield "python"

    #print 4/0

#    yield str(uwsgi.masterpid())

    #print(uwsgi.pippo)

    #print 4/0
#    try:
#        print 4/0
#
#        print uwsgi.pippo
#    except Exception:
#        print "bah"

#    print("ok")

#    yield 4/0

    yield '<h1>uWSGI status ('+env['SCRIPT_NAME']+')</h1>'
    yield 'masterpid: <b>' + str(uwsgi.masterpid()) + '</b><br/>'

    yield 'started on: <b>' + time.ctime(uwsgi.started_on) + '</b><br/>'

    yield 'buffer size: <b>' + str(uwsgi.buffer_size) + '</b><br/>'

    yield 'total_requests: <b>' + str(uwsgi.total_requests()) + '</b><br/>'

    yield 'workers: <b>' + str(uwsgi.numproc) + '</b><br/>'

    yield '<table border="1">'
    yield '<th>worker id</th><th>pid</th><th>in request</th><th>requests</th><th>running time</th><th>address space</th><th>rss</th>'

    workers = uwsgi.workers()

    yield '<h2>workers</h2>'

    for w in workers:
        #print(w)
        #print(w['running_time'])
        if w is not None:
            yield '<tr><td>' + str(w['id']) + '</td><td>' + str(w['pid']) + '</td><td>' + str(w['pid']) + '</td><td>' + str(w['requests']) + '</td><td>' + str(w['running_time']) + '</td><td>' + str(w['vsz']) + '</td><td>' + str(w['rss']) + '</td></tr>'
            print(w)

    yield '</table>'
コード例 #3
0
    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)
コード例 #4
0
def test_uwsgi_collector():
    registry = BaseRegistry()
    uwsgi_collector = UWSGICollector(namespace="uwsgi_namespace",
                                     labels={"env_role": "test"})

    registry.register(uwsgi_collector)

    collectors = {x.name: x for x in registry.collect()}

    metrics_count = sorted(
        map(
            lambda x: x.split(" ")[2],
            filter(lambda x: x.startswith("# HELP"),
                   [x for x in registry_to_text(registry).split("\n")])))

    assert len(metrics_count) == len(set(metrics_count))

    assert len(registry_to_text(registry).split("\n")) == 60

    assert collectors["uwsgi_namespace:buffer_size_bytes"].get_samples(
    )[0].value == uwsgi.buffer_size
    assert collectors["uwsgi_namespace:processes_total"].get_samples(
    )[0].value == uwsgi.numproc
    assert collectors["uwsgi_namespace:requests_total"].get_samples(
    )[0].value == uwsgi.total_requests()

    for name in [
            "requests", "respawn_count", "running_time", "exceptions",
            "delta_requests"
    ]:
        assert collectors["uwsgi_namespace:process:{0}".format(
            name)].get_samples()[0].value == uwsgi.workers()[0][name]

    assert uwsgi_collector.metric_name("test") == "uwsgi_namespace:test"
コード例 #5
0
ファイル: testapp.py プロジェクト: CashStar/uwsgi
def reload(env, start_response):

    start_response('200 OK', [('Content-Type', 'text/html')])

    #uwsgi.sorry_i_need_to_block()
    #time.sleep(1)

    #uwsgi.reload()

#    print str(uwsgi.masterpid()) + "\n"

#    print "i am python"
    #yo()

#    yield "python"

    #print 4/0

#    yield str(uwsgi.masterpid())

    #print uwsgi.pippo

    #print 4/0
#    try:
#        print 4/0
#
#        print uwsgi.pippo
#    except:
#        print "bah"

#    print "ok"

#    yield 4/0

    yield '<h1>uWSGI status ('+env['SCRIPT_NAME']+')</h1>';
    yield 'masterpid: <b>' + str(uwsgi.masterpid()) + '</b><br/>'

    yield 'started on: <b>' + time.ctime(uwsgi.started_on) + '</b><br/>'

    yield 'buffer size: <b>' + str(uwsgi.buffer_size) + '</b><br/>'

    yield 'total_requests: <b>' + str(uwsgi.total_requests()) + '</b><br/>'

    yield 'workers: <b>' + str(uwsgi.numproc) + '</b><br/>'

    yield '<table border="1">'
    yield '<th>worker id</th><th>pid</th><th>in request</th><th>requests</th><th>running time</th><th>address space</th><th>rss</th>'

    workers = uwsgi.workers();

    yield '<h2>workers</h2>'

    for w in workers:
        #print w
        #print w['running_time']
        if w is not None:
            yield '<tr><td>'+ str(w['id']) +'</td><td>' + str(w['pid']) + '</td><td>' + str(w['pid']) + '</td><td>' + str(w['requests']) + '</td><td>' + str(w['running_time']) + '</td><td>' + str(w['vsz']) + '</td><td>' + str(w['rss']) + '</td></tr>'
            print w

    yield '</table>'
コード例 #6
0
ファイル: views.py プロジェクト: vstoykov/django-uwsgi
def info(request):
    context = {"title": "uWSGI is missing"}
    if uwsgi:
        total_time = time.time() - uwsgi.started_on
        workers = uwsgi.workers()

        def extend_worker(worker):
            worker["running_time"] = worker["running_time"] / 1000  # Get running time In miliseconds
            worker["load"] = (
                worker["running_time"] / total_time / 10 / len(workers)
            )  # In percents devided by number of workers
            worker["last_spawn_str"] = time.ctime(worker["last_spawn"])
            return worker

        context.update(
            {
                "title": "uWSGI status",
                "masterpid": uwsgi.masterpid(),
                "started_on": datetime.fromtimestamp(uwsgi.started_on),
                "buffer_size": uwsgi.buffer_size,
                "total_requests": uwsgi.total_requests(),
                "total_time": total_time,
                "numproc": uwsgi.numproc,
                "workers": map(extend_worker, workers),
            }
        )

    return render(request, "django_uwsgi/info.html", context)
コード例 #7
0
ファイル: panels.py プロジェクト: edufelipe/uwsgi_django
    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)
コード例 #8
0
def uwsgi_context(request):
    try:
        # noinspection PyPackageRequirements
        import uwsgi

        return {
            'UWSGI': {
                'enabled': True,
                'numproc': uwsgi.numproc,
                'buffer_size': uwsgi.buffer_size,
                'started_on': datetime.fromtimestamp(uwsgi.started_on, tz=utc),
                'numworkers': len(uwsgi.workers()),
                'masterpid': uwsgi.masterpid(),
                'total_requests': uwsgi.total_requests(),
                'request_id': uwsgi.request_id(),
                'worker_id': uwsgi.worker_id(),
            }
        }

    except ImportError:
        return {
            'UWSGI': {
                'enabled': False,
            }
        }
コード例 #9
0
ファイル: panels.py プロジェクト: ionelmc/django-uwsgi-admin
    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)
コード例 #10
0
def update_carbon(signum):
    # connect to the carbon server
    carbon_fd = uwsgi.connect(CARBON_SERVER)
    # send data to the carbon server
    uwsgi.send(carbon_fd, "uwsgi.%s.requests %d %d\n" % (uwsgi.hostname, uwsgi.total_requests(), int(time.time())))
    # close the connection with the carbon server
    uwsgi.close(carbon_fd)
コード例 #11
0
def get_status():
    """Retrieve API specific stats upon successful GET."""
    status = {"worker_status": []}
    for worker in uwsgi.workers():
        del worker["apps"]
        worker["status"] = worker["status"].decode("utf-8")
        status["worker_status"].append(worker)
    status["total_requests"] = uwsgi.total_requests()
    return jsonify(status)
コード例 #12
0
    def collect(self):
        for name, value in [("processes", uwsgi.numproc),
                            ("total_requests", uwsgi.total_requests()),
                            ("buffer_size", uwsgi.buffer_size),
                            ("started_on", uwsgi.started_on),
                            ("cores", uwsgi.cores)]:
            yield self.get_sample(name, value)

        yield self.get_memory_samples()

        for x in self.get_workers_samples(uwsgi.workers()):
            yield x
コード例 #13
0
ファイル: views.py プロジェクト: christandiono/genenews
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'])

	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,
						}, RequestContext(request, {}))
コード例 #14
0
ファイル: views.py プロジェクト: xwssole/uwsgi
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, {}))
コード例 #15
0
ファイル: views.py プロジェクト: ionelmc/django-uwsgi-admin
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,
    })
コード例 #16
0
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,
        })
コード例 #17
0
ファイル: hello_world_rrdtool.py プロジェクト: xwssole/uwsgi
def rrdtool_updater(sig, sec):
	rrdtool.update('test.rrd', str(int(time.time()))+':'+str(uwsgi.total_requests()))
コード例 #18
0
ファイル: testapp.py プロジェクト: 20tab/uwsgi
def reload(env, start_response):

    start_response('200 OK', [('Content-Type', 'text/html')])

    #uwsgi.sorry_i_need_to_block()
    #time.sleep(1)

    #uwsgi.reload()

#    print str(uwsgi.masterpid()) + "\n"

#    print "i am python"
    #yo()

#    yield "python"

    #print 4/0

#    yield str(uwsgi.masterpid())

    #print uwsgi.pippo

    #print 4/0
#    try:
#        print 4/0
#
#        print uwsgi.pippo
#    except:
#        print "bah"

#    print "ok"

#    yield 4/0

    yield '<h1>uWSGI status ('+env['SCRIPT_NAME']+')</h1>';
    yield 'masterpid: <b>' + str(uwsgi.masterpid()) + '</b><br/>'

    yield 'started on: <b>' + time.ctime(uwsgi.started_on) + '</b><br/>'

    yield 'buffer size: <b>' + str(uwsgi.buffer_size) + '</b><br/>'

    yield 'total_requests: <b>' + str(uwsgi.total_requests()) + '</b><br/>'

    yield 'workers: <b>' + str(uwsgi.numproc) + '</b><br/>'

    yield '<h2>dynamic options</h2>'

    yield '<b>logging</b>: ' + str(uwsgi.get_option(0)) + '<br/>'
    yield '<b>max_requests</b>: '  + str(uwsgi.getoption(1)) + '<br/>'
    yield '<b>socket_timeout</b>: ' + str(uwsgi.getoption(2)) + '<br/>'
    yield '<b>memory_debug</b>: ' + str(uwsgi.getoption(3)) + '<br/>'
    yield '<b>master_interval</b>: ' + str(uwsgi.getoption(4)) + '<br/>'
    yield '<b>harakiri</b>: ' + str(uwsgi.getoption(5)) + '<br/>'
    yield '<b>cgi_mode</b>: ' + str(uwsgi.get_option(6)) + '<br/>'
    yield '<b>threads</b>: ' + str(uwsgi.get_option(7)) + '<br/>'
    yield '<b>process_reaper</b>: ' + str(uwsgi.get_option(8)) + '<br/>'

    yield '<table border="1">'
    yield '<th>worker id</th><th>pid</th><th>in request</th><th>requests</th><th>running time</th><th>address space</th><th>rss</th>'

    workers = uwsgi.workers();

    yield '<h2>workers</h2>'

    for w in workers:
        #print w
        #print w['running_time']
        if w is not None:
            yield '<tr><td>'+ str(w['id']) +'</td><td>' + str(w['pid']) + '</td><td>' + str(w['pid']) + '</td><td>' + str(w['requests']) + '</td><td>' + str(w['running_time']) + '</td><td>' + str(w['vsz']) + '</td><td>' + str(w['rss']) + '</td></tr>'
            print w

    yield '</table>'
コード例 #19
0
ファイル: hello_world_rrdtool.py プロジェクト: mlzboy/resys
def rrdtool_updater(env):
	uwsgi.set_spooler_frequency(s_freq)
	rrdtool.update('../test.rrd', str(int(time.time()))+':'+str(uwsgi.total_requests()))
	uwsgi.send_to_spooler({})
コード例 #20
0
ファイル: testapp.py プロジェクト: xwssole/uwsgi
def reload(env, start_response):

    start_response('200 OK', [('Content-Type', 'text/html')])

    #uwsgi.sorry_i_need_to_block()
    #time.sleep(1)

    #uwsgi.reload()

    #    print str(uwsgi.masterpid()) + "\n"

    #    print "i am python"
    #yo()

    #    yield "python"

    #print 4/0

    #    yield str(uwsgi.masterpid())

    #print uwsgi.pippo

    #print 4/0
    #    try:
    #        print 4/0
    #
    #        print uwsgi.pippo
    #    except:
    #        print "bah"

    #    print "ok"

    #    yield 4/0

    yield '<h1>uWSGI status (' + env['SCRIPT_NAME'] + ')</h1>'
    yield 'masterpid: <b>' + str(uwsgi.masterpid()) + '</b><br/>'

    yield 'started on: <b>' + time.ctime(uwsgi.started_on) + '</b><br/>'

    yield 'buffer size: <b>' + str(uwsgi.buffer_size) + '</b><br/>'

    yield 'total_requests: <b>' + str(uwsgi.total_requests()) + '</b><br/>'

    yield 'workers: <b>' + str(uwsgi.numproc) + '</b><br/>'

    yield '<h2>dynamic options</h2>'

    yield '<b>logging</b>: ' + str(uwsgi.get_option(0)) + '<br/>'
    yield '<b>max_requests</b>: ' + str(uwsgi.getoption(1)) + '<br/>'
    yield '<b>socket_timeout</b>: ' + str(uwsgi.getoption(2)) + '<br/>'
    yield '<b>memory_debug</b>: ' + str(uwsgi.getoption(3)) + '<br/>'
    yield '<b>master_interval</b>: ' + str(uwsgi.getoption(4)) + '<br/>'
    yield '<b>harakiri</b>: ' + str(uwsgi.getoption(5)) + '<br/>'
    yield '<b>cgi_mode</b>: ' + str(uwsgi.get_option(6)) + '<br/>'
    yield '<b>threads</b>: ' + str(uwsgi.get_option(7)) + '<br/>'
    yield '<b>process_reaper</b>: ' + str(uwsgi.get_option(8)) + '<br/>'

    yield '<table border="1">'
    yield '<th>worker id</th><th>pid</th><th>in request</th><th>requests</th><th>running time</th><th>address space</th><th>rss</th>'

    workers = uwsgi.workers()

    yield '<h2>workers</h2>'

    for w in workers:
        #print w
        #print w['running_time']
        if w is not None:
            yield '<tr><td>' + str(w['id']) + '</td><td>' + str(
                w['pid']) + '</td><td>' + str(w['pid']) + '</td><td>' + str(
                    w['requests']) + '</td><td>' + str(
                        w['running_time']) + '</td><td>' + str(
                            w['vsz']) + '</td><td>' + str(
                                w['rss']) + '</td></tr>'
            print w

    yield '</table>'
コード例 #21
0
ファイル: heavytest.py プロジェクト: Algy/uwsgi
def app002(env, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return "requests: %d" % uwsgi.total_requests()
コード例 #22
0
ファイル: wrapper.py プロジェクト: fossabot/beecell
 def total_requests(self):
     ''' '''
     return uwsgi.total_requests()
コード例 #23
0
def application(env, start_response):
    print env
    start_response('200 OK', [('Content-Type', 'text/html')])

    yield '<h1>uWSGI %s status</h1>' % uwsgi.version
    yield 'masterpid: <b>' + str(uwsgi.masterpid()) + '</b><br/>'

    yield 'started on: <b>' + time.ctime(uwsgi.started_on) + '</b><br/>'

    yield 'buffer size: <b>' + str(uwsgi.buffer_size) + '</b><br/>'

    yield 'total_requests: <b>' + str(uwsgi.total_requests()) + '</b><br/>'

    yield 'log size: <b>' + str(uwsgi.logsize()) + '</b><br/>'

    yield 'workers: <b>' + str(uwsgi.numproc) + '</b><br/>'

    yield "cwd: <b>%s</b><br/>" % os.getcwd()

    try:
        yield "mode: <b>%s</b><br/>" % uwsgi.mode
    except:
        pass

    try:
        yield "pidfile: <b>%s</b><br/>" % uwsgi.pidfile
    except:
        pass

    yield "<h2>Hooks</h2>"

    for h in range(0,255):
        if uwsgi.has_hook(h):
            yield "%d<br/>" % h

    yield '<h2>dynamic options</h2>'

    yield '<table border="1">'
    yield '<th>worker id</th><th>pid</th><th>in request</th><th>requests</th><th>running time</th><th>address space</th><th>rss</th>'

    workers = uwsgi.workers();

    yield '<h2>workers</h2>'

    for w in workers:
        #print w
        #print w['running_time']
        if w is not None:
            yield '<tr><td>'+ str(w['id']) +'</td><td>' + str(w['pid']) + '</td><td>' + str(w['pid']) + '</td><td>' + str(w['requests']) + '</td><td>' + str(w['running_time']) + '</td><td>' + str(w['vsz']) + '</td><td>' + str(w['rss']) + '</td></tr>'
            print w

    yield '</table>'

    yield "<h2>PYTHONPATH</h2>"

    yield "<ul>"
    for p in sys.path:
        yield "<li>%s</li>" % p

    yield "</ul>"

    yield "<i>%s</i>" % str(os.uname())
コード例 #24
0
ファイル: heavytest.py プロジェクト: asterite3/uwsgifuzz
def app002(env, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return "requests: %d" % uwsgi.total_requests()