def _deserialize_script_sequences()

in cookbooks/aws-parallelcluster-environment/files/custom_action_executor/custom_action_executor.py [0:0]


    def _deserialize_script_sequences(self, cluster_config, event_name, node_type, queue_name, pool_name):
        # this is a good candidate for sharing logic with pcluster as library on the nodes
        try:
            if node_type == "HeadNode":
                script_data = cluster_config["HeadNode"]["CustomActions"][event_name]
            elif node_type == "LoginNode":
                script_data = next(
                    (
                        pool
                        for pool in cluster_config["LoginNodes"]["Pools"]
                        if pool["Name"] == pool_name and pool["CustomActions"]
                    ),
                    None,
                )["CustomActions"][event_name]
            else:
                script_data = next(
                    (
                        queue
                        for queue in next(
                            list_value
                            for list_value in cluster_config["Scheduling"].values()
                            if isinstance(list_value, list)
                        )
                        if queue["Name"] == queue_name and queue["CustomActions"]
                    ),
                    None,
                )["CustomActions"][event_name]

            sequence = self._extract_script_sequence(script_data)
        except (KeyError, TypeError) as err:
            logging.debug("Ignoring missing %s in configuration, cause: %s", event_name, err)
            sequence = []
        return sequence