<commit_before>module DTK
  class Task < Model
    module NodeGroupProcessingMixin
      def node_group_member?()
        (self[:executable_action]||{})[:node_group_member]
      end

      def set_node_group_member_executable_action!(parent)
        ret = self
        unless ea = self[:executable_action]
          Log.error("Unexpected that self does not have field :executable_action")
          return ret
        end
        unless parent_ea = parent[:executable_action]
          Log.error("Unexpected that parent does not have field :executable_action")
          return ret
        end
        ExecuteActionFieldsToCopy.each{|field|ea[field] = parent_ea[field]}
        ret
      end
      ExecuteActionFieldsToCopy = [:component_actions,:state_change_types,:config_agent_type,:assembly_idh]
    end

    module NodeGroupProcessing
      #replaces node groups with theit elements
      def self.decompose_node_groups!(task)
        decompose!(task)
        task
      end
     private
      def self.decompose!(task)
        case task.basic_type()
          when :executable_action
            decompose_executable_action!(task)
          when :decomposed_node_group
            #no op
          when :sequential
            task.subtasks.map{|st|decompose!(st)}
          when :concurrent
            task.subtasks.map{|st|decompose!(st)}
          else
            Log.error("do not have rules to process task")
        end
      end
      
      def self.decompose_executable_action!(task)
        # noop if this is not a node group that decomposes 
        ea = task[:executable_action]
        return unless ea.node_is_node_group?()
        <commit_msg>fixed bug where node groups get decomposed and dont send service_name<commit_after>module DTK
  class Task < Model
    module NodeGroupProcessingMixin
      def node_group_member?()
        (self[:executable_action]||{})[:node_group_member]
      end

      def set_node_group_member_executable_action!(parent)
        ret = self
        unless ea = self[:executable_action]
          Log.error("Unexpected that self does not have field :executable_action")
          return ret
        end
        unless parent_ea = parent[:executable_action]
          Log.error("Unexpected that parent does not have field :executable_action")
          return ret
        end
        ExecuteActionFieldsToCopy.each{|field|ea[field] = parent_ea[field]}
        ret
      end
      ExecuteActionFieldsToCopy = [:component_actions,:state_change_types,:config_agent_type,:assembly_idh,:inter_node_stage]
    end

    module NodeGroupProcessing
      #replaces node groups with theit elements
      def self.decompose_node_groups!(task)
        decompose!(task)
        task
      end
     private
      def self.decompose!(task)
        case task.basic_type()
          when :executable_action
            decompose_executable_action!(task)
          when :decomposed_node_group
            #no op
          when :sequential
            task.subtasks.map{|st|decompose!(st)}
          when :concurrent
            task.subtasks.map{|st|decompose!(st)}
          else
            Log.error("do not have rules to process task")
        end
      end
      
      def self.decompose_executable_action!(task)
        # noop if this is not a node group that decomposes 
        ea = task[:executable_action]
        return unless ea.node_is_node_group?()
        
{'fraction_non_alphanumeric': 0.0721830985915493, 'fraction_numerical': 0.0, 'mean_word_length': 2.3586206896551722, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2486624', 'n_tokens_mistral': 963, 'n_tokens_neox': 941, 'n_words': 226}