openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgr...@apache.org
Subject [incubator-openwhisk-composer-python] branch master updated: Rename $resume parameter to $composer (#5)
Date Fri, 22 Feb 2019 15:51:18 GMT
This is an automated email from the ASF dual-hosted git repository.

dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-composer-python.git


The following commit(s) were added to refs/heads/master by this push:
     new 973b287  Rename $resume parameter to $composer (#5)
973b287 is described below

commit 973b287a47058f32f3362c7ea201bb9b513bd9f7
Author: Lionel Villard <villard@us.ibm.com>
AuthorDate: Fri Feb 22 10:51:13 2019 -0500

    Rename $resume parameter to $composer (#5)
---
 docs/COMPOSITIONS.md       |  6 ++++++
 src/conductor/conductor.py | 16 ++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/docs/COMPOSITIONS.md b/docs/COMPOSITIONS.md
index 346739f..53e3998 100644
--- a/docs/COMPOSITIONS.md
+++ b/docs/COMPOSITIONS.md
@@ -58,6 +58,12 @@ the sequence is not executed. Moreover, if the sequence is enclosed in
an error
 handling composition like a `composer.try(sequence, handler)` combinator, the
 execution continues with the error handler.
 
+### Reserved parameter name
+
+The field name `$composer` is reserved for composer internal use. Compositions
+and composed actions should not expect or return parameter objects with a
+top-level field named `$composer`.
+
 ## Data flow
 
 The invocation of a composition triggers a series of computations (possibly
diff --git a/src/conductor/conductor.py b/src/conductor/conductor.py
index 858dbfc..e608a12 100644
--- a/src/conductor/conductor.py
+++ b/src/conductor/conductor.py
@@ -251,7 +251,7 @@ def conductor(composition): # main.
 
     @operator
     def _action(p, node, index, inspect, step):
-        return { 'method': 'action', 'action': node['name'], 'params': p['params'], 'state':
{ '$resume': p['s'] } }
+        return { 'method': 'action', 'action': node['name'], 'params': p['params'], 'state':
{ '$composer': p['s'] } }
 
     @operator
     def _function(p, node, index, inspect, step):
@@ -282,7 +282,7 @@ def conductor(composition): # main.
     def _async(p, node, index, inspect, step):
         nonlocal wsk
 
-        p['params']['$resume'] = { 'state': p['s']['state'], 'stack': [{ 'marker': True }]
+ p['s']['stack'] }
+        p['params']['$composer'] = { 'state': p['s']['state'], 'stack': [{ 'marker': True
}] + p['s']['stack'] }
         p['s']['state'] = index + node['return']
         if wsk is None:
             wsk = openwhisk({ 'ignore_certs': True })
@@ -400,14 +400,14 @@ def conductor(composition): # main.
 
     def invoke(params):
         ''' do invocation '''
-        resume = params.get('$resume', {})
-        if '$resume' in params:
-            del params['$resume']
-        resume['session'] = resume.get('session', os.getenv('__OW_ACTIVATION_ID'))
+        pcomposer = params.get('$composer', {})
+        if '$composer' in params:
+            del params['$composer']
+        pcomposer['session'] = pcomposer.get('session', os.getenv('__OW_ACTIVATION_ID'))
 
         # current state
         s = { 'state': 0, 'stack': [], 'resuming': True }
-        s.update(resume)
+        s.update(pcomposer)
         p = { 's': s, 'params': params }
 
         if not isinstance(p['s']['state'], int):
@@ -415,7 +415,7 @@ def conductor(composition): # main.
         if not isinstance(p['s']['stack'], list):
             return internalError('stack parameter is not an array')
 
-        if 'resuming' in resume:
+        if 'resuming' in pcomposer:
             inspect_errors(p) # handle error objects when resuming
 
         result = None


Mime
View raw message