From e176af1702ab2e00308ad34b077fc35dce9692a7 Mon Sep 17 00:00:00 2001 From: "roberto@sirius" Date: Tue, 4 Jan 2011 17:42:48 +0100 Subject: [PATCH] you can do RPC from uwsgicc --- uwsgicc/templates/index.html | 17 ++++++++++++++++- uwsgicc/uwsgicc.py | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/uwsgicc/templates/index.html b/uwsgicc/templates/index.html index 2cd429ba..6d69804c 100644 --- a/uwsgicc/templates/index.html +++ b/uwsgicc/templates/index.html @@ -138,7 +138,7 @@ a:hover{

uWSGI {{uwsgi.version}} Control Center

-information | options | logs | workers {% if uwsgi.cluster() %}| cluster{% endif %} +information | options | logs | workers | rpc {% if uwsgi.cluster() %}| cluster{% endif %}
{% with messages = get_flashed_messages() %} @@ -225,6 +225,21 @@ a:hover{ + +

RPC

+
+ +
+node address (leave empty for local rpc): function: args (separated by space, optional):
+
+ +
+ + +
+ {% if uwsgi.cluster() %} diff --git a/uwsgicc/uwsgicc.py b/uwsgicc/uwsgicc.py index 3f9561f7..fa441469 100644 --- a/uwsgicc/uwsgicc.py +++ b/uwsgicc/uwsgicc.py @@ -21,3 +21,21 @@ def log(): uwsgi.log(request.form['message']) flash("log message written") return redirect(url_for('index')) + +@app.route("/rpc", methods=['POST']) +def log(): + node = str(request.form['node']) + if node == '': + node = None + + fargs = str(request.form['args']) + + args = fargs.split() + + if len(args) > 0: + ret = uwsgi.rpc(str(node), str(request.form['func']), *map(str, args)) + else: + ret = uwsgi.rpc(str(node), str(request.form['func'])) + + flash("rpc \"%s\" returned: %s" % (request.form['func'], ret) ) + return redirect(url_for('index'))