From ec7edb2907bc16be74d4c97fe258659f05fc98f5 Mon Sep 17 00:00:00 2001 From: Ryan Frantz Date: Fri, 19 Oct 2018 18:27:46 -0400 Subject: [PATCH 1/2] Adds full_return support in libpepper. - This allows folks using this as a library to get the same behavior as CLI (cli.run() set full_return=True), if they so choose. --- pepper/libpepper.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pepper/libpepper.py b/pepper/libpepper.py index 7b4e606..7fe3799 100644 --- a/pepper/libpepper.py +++ b/pepper/libpepper.py @@ -298,7 +298,7 @@ def low(self, lowstate, path='/'): return self.req(path, lowstate) def local(self, tgt, fun, arg=None, kwarg=None, expr_form='glob', - timeout=None, ret=None): + timeout=None, ret=None, full_return=False): ''' Run a single command using the ``local`` client @@ -325,10 +325,13 @@ def local(self, tgt, fun, arg=None, kwarg=None, expr_form='glob', if ret: low['ret'] = ret + if full_return: + low['full_return'] = full_return + return self.low([low]) def local_async(self, tgt, fun, arg=None, kwarg=None, expr_form='glob', - timeout=None, ret=None): + timeout=None, ret=None, full_return=False): ''' Run a single command using the ``local_async`` client @@ -355,10 +358,13 @@ def local_async(self, tgt, fun, arg=None, kwarg=None, expr_form='glob', if ret: low['ret'] = ret + if full_return: + low['full_return'] = full_return + return self.low([low]) def local_batch(self, tgt, fun, arg=None, kwarg=None, expr_form='glob', - batch='50%', ret=None): + batch='50%', ret=None, full_return=False): ''' Run a single command using the ``local_batch`` client @@ -385,6 +391,9 @@ def local_batch(self, tgt, fun, arg=None, kwarg=None, expr_form='glob', if ret: low['ret'] = ret + if full_return: + low['full_return'] = full_return + return self.low([low]) def lookup_jid(self, jid): From ce6a80c5fd573bfc318089542ac47c17037bbf3a Mon Sep 17 00:00:00 2001 From: Ryan Frantz Date: Mon, 22 Oct 2018 09:45:57 -0400 Subject: [PATCH 2/2] Adds full_return support to runners. --- pepper/libpepper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pepper/libpepper.py b/pepper/libpepper.py index 7fe3799..120f170 100644 --- a/pepper/libpepper.py +++ b/pepper/libpepper.py @@ -396,14 +396,14 @@ def local_batch(self, tgt, fun, arg=None, kwarg=None, expr_form='glob', return self.low([low]) - def lookup_jid(self, jid): + def lookup_jid(self, jid, full_return=False): ''' Get job results Wraps :meth:`runner`. ''' - return self.runner('jobs.lookup_jid', jid='{0}'.format(jid)) + return self.runner('jobs.lookup_jid', jid='{0}'.format(jid), full_return=full_return) def runner(self, fun, arg=None, **kwargs): '''