Skip to content

Commit

Permalink
Add input of the workflow as part of the context.
Browse files Browse the repository at this point in the history
Some workflows can be generic enough to work with a set of parameters that can be provided
at the execution of the workflow.
  • Loading branch information
xethorn committed Jan 5, 2015
1 parent 1880858 commit aaa3ee9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions garcon/event.py
Expand Up @@ -64,12 +64,16 @@ def get_current_context(events):
for event in events:
event_id = event.get('eventId')
event_type = event.get('eventType')
result = None

if event_type != 'ActivityTaskCompleted':
continue
if event_type == 'ActivityTaskCompleted':
attributes = event['activityTaskCompletedEventAttributes']
result = attributes.get('result')

if event_type == 'WorkflowExecutionStarted':
attributes = event['workflowExecutionStartedEventAttributes']
result = attributes.get('input')

attributes = event['activityTaskCompletedEventAttributes']
result = attributes.get('result')
if result:
context.update(json.loads(result))

Expand Down

0 comments on commit aaa3ee9

Please sign in to comment.