Revision f7d9b3aa lib/rpc.py
b/lib/rpc.py | ||
---|---|---|
430 | 430 |
else: |
431 | 431 |
return encoder_fn(argkind)(value) |
432 | 432 |
|
433 |
def _Call(self, cdef, node_list, timeout, args):
|
|
433 |
def _Call(self, cdef, node_list, args): |
|
434 | 434 |
"""Entry point for automatically generated RPC wrappers. |
435 | 435 |
|
436 | 436 |
""" |
437 |
(procedure, _, _, argdefs, postproc_fn, _) = cdef |
|
437 |
(procedure, _, timeout, argdefs, postproc_fn, _) = cdef |
|
438 |
|
|
439 |
if callable(timeout): |
|
440 |
read_timeout = timeout(args) |
|
441 |
else: |
|
442 |
read_timeout = timeout |
|
438 | 443 |
|
439 | 444 |
body = serializer.DumpJson(map(self._encoder, |
440 | 445 |
zip(map(compat.snd, argdefs), args)), |
441 | 446 |
indent=False) |
442 | 447 |
|
443 |
result = self._proc(node_list, procedure, body, read_timeout=timeout) |
|
448 |
result = self._proc(node_list, procedure, body, read_timeout=read_timeout)
|
|
444 | 449 |
|
445 | 450 |
if postproc_fn: |
446 | 451 |
return postproc_fn(result) |
... | ... | |
620 | 625 |
""" |
621 | 626 |
return self._InstDict(instance, osp=osparams) |
622 | 627 |
|
623 |
# |
|
624 |
# Begin RPC calls |
|
625 |
# |
|
626 |
|
|
627 |
def call_test_delay(self, node_list, duration): # pylint: disable=W0221 |
|
628 |
"""Sleep for a fixed time on given node(s). |
|
629 |
|
|
630 |
This is a multi-node call. |
|
631 |
|
|
632 |
""" |
|
633 |
# TODO: Use callable timeout calculation |
|
634 |
return _generated_rpc.RpcClientDefault.call_test_delay(self, |
|
635 |
node_list, duration, read_timeout=int(duration + 5)) |
|
636 |
|
|
637 | 628 |
|
638 | 629 |
class JobQueueRunner(_RpcClientBase, _generated_rpc.RpcClientJobQueue): |
639 | 630 |
"""RPC wrappers for job queue. |
Also available in: Unified diff