def validate_decisions(self, decisions):
        problems = []

        # check close decision is last
        # (the real SWF service also works that way if you provide 2 close decision tasks)
        for dcs in decisions[:-1]:
            close_decision_types = [
                "CompleteWorkflowExecution",
                "FailWorkflowExecution",
                "CancelWorkflowExecution",
            ]
            if dcs["decisionType"] in close_decision_types:
                raise SWFValidationException(
                    "Close must be last decision in list"
                )

        decision_number = 0
        for dcs in decisions:
            decision_number += 1
            # check decision types mandatory attributes
            # NB: the real SWF service seems to check attributes even for attributes list
            # that are not in line with the decisionType, so we do the same
            attrs_to_check = [d for d in dcs.keys() if d.endswith("DecisionAttributes")]
            if dcs["decisionType"] in self.KNOWN_DECISION_TYPES:
                decision_type = dcs["decisionType"]
                decision_attr = "{0}DecisionAttributes".format(decapitalize(decision_type))
                attrs_to_check.append(decision_attr)
            for attr in attrs_to_check:
                problems += self._check_decision_attributes(attr, dcs.get(attr, {}), decision_number)
            # check decision type is correct
            if dcs["decisionType"] not in self.KNOWN_DECISION_TYPES:
                problems.append({
                    "type": "bad_decision_type",
                    "value": dcs["decisionType"],
                    "where": "decisions.{0}.member.decisionType".format(decision_number),
                    "possible_values": ", ".join(self.KNOWN_DECISION_TYPES),
                })

        # raise if any problem
        if any(problems):
            raise SWFDecisionValidationException(problems)
Create and run the IPython cluster.
dataset/ETHPy150Open spulec/moto/moto/swf/models/workflow_execution.py/WorkflowExecution.validate_decisions--crossover with--dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/apps/ipclusterapp.py/launch_new_instance