#NEWLINE# def handle_decisions( self , event_id , decisions ) : #NEWLINE# #INDENT# '\n        Handles a Decision according to SWF docs.\n        See: http://docs.aws.amazon.com/amazonswf/latest/apireference/API_Decision.html\n        ' #NEWLINE# for decision in decisions : #NEWLINE# #INDENT# decision_type = decision [ 'decisionType' ] #NEWLINE# attributes_key = '{0}DecisionAttributes' . format ( decapitalize ( decision_type ) ) #NEWLINE# attributes = decision . get ( attributes_key , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( decision_type == 'CompleteWorkflowExecution' ) : #NEWLINE# #INDENT# self . complete ( event_id , attributes . get ( 'result' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( decision_type == 'FailWorkflowExecution' ) : #NEWLINE# #INDENT# self . fail ( event_id , attributes . get ( 'details' ) , attributes . get ( 'reason' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( decision_type == 'ScheduleActivityTask' ) : #NEWLINE# #INDENT# self . schedule_activity_task ( event_id , attributes ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise NotImplementedError ( 'Cannot handle decision: {0}' . format ( event_id ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . open_counts [ 'openDecisionTasks' ] -= 1