summaryrefslogtreecommitdiffstats
path: root/func/minion/server.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-01-23 15:58:48 -0500
committerMichael DeHaan <mdehaan@redhat.com>2008-01-23 15:58:48 -0500
commit19e4d1ba808cbbe95568271a5b0075b8422e4fb6 (patch)
tree197d55cf717319c5ffe565f9aa8a639b962fc490 /func/minion/server.py
parentce0eaca23fb42f77f67408e509bbe091f4c27e56 (diff)
downloadfunc-19e4d1ba808cbbe95568271a5b0075b8422e4fb6.tar.gz
func-19e4d1ba808cbbe95568271a5b0075b8422e4fb6.tar.xz
func-19e4d1ba808cbbe95568271a5b0075b8422e4fb6.zip
Double-barrel asynchronous calls. Async can now occur on both sides simultaneously and still appears as if there is only one
"global" job id to the API caller, the minion job id's are managed in the background, complete with partial result response as things come in which should be very nice for ajaxy implication. job_status API does still need to be modified to list active jobs as well as to store the job name.
Diffstat (limited to 'func/minion/server.py')
-rwxr-xr-xfunc/minion/server.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/func/minion/server.py b/func/minion/server.py
index 6e55e70..1b2a556 100755
--- a/func/minion/server.py
+++ b/func/minion/server.py
@@ -28,6 +28,7 @@ from func.config import read_config
from func.commonconfig import FuncdConfig
from func import logger
from func import certs
+import func.jobthing as jobthing
# our modules
import AuthedXMLRPCServer
@@ -196,6 +197,16 @@ class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer,
peer_cert = r.get_peer_certificate()
ip = a[0]
+
+ # generally calling conventions are: hardware.info
+ # async convention is async.hardware.info
+ # here we parse out the async to decide how to invoke it.
+ # see the async docs on the Wiki for further info.
+ async_dispatch = False
+ if method.startswith("async."):
+ async_dispatch = True
+ method = method.replace("async.","",1)
+
if not self._check_acl(peer_cert, ip, method, params):
raise codes.AccessToMethodDenied
@@ -207,7 +218,11 @@ class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer,
sub_hash = peer_cert.subject_name_hash()
self.audit_logger.log_call(ip, cn, sub_hash, method, params)
- return self.get_dispatch_method(method)(*params)
+ if not async_dispatch:
+ return self.get_dispatch_method(method)(*params)
+ else:
+ meth = self.get_dispatch_method(method)
+ return jobthing.minion_async_run(meth, *params)
def auth_cb(self, request, client_address):
peer_cert = request.get_peer_certificate()