Skip to content

Commit

Permalink
Merge pull request #13 from xethorn/mo-14-jan-add-input-as-part-of-co…
Browse files Browse the repository at this point in the history
…ntext

Add input of the workflow as part of the context.
  • Loading branch information
xethorn committed Jan 5, 2015
2 parents d2cdecd + aaa3ee9 commit 0a5eef2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions garcon/event.py
Original file line number Diff line number Diff line change
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 0a5eef2

Please sign in to comment.