<commit_before>require 'mcollective'
r8_nested_require('mcollective','monkey_patches')
module DTK
  module CommandAndControlAdapter
    class Mcollective < CommandAndControlNodeConfig
      r8_nested_require('mcollective','assembly_action')
      r8_nested_require('mcollective','multiplexer')
      r8_nested_require('mcollective','config')
      extend AssemblyActionClassMixin
      def self.server_host()
        R8::Config[:command_and_control][:node_config][:mcollective][:host]
      end

      def self.discover(filter, timeout, limit, client)
        Config.discover(filter, timeout, limit, client)
      end

      def self.install_script(node,bindings)
        Config.install_script(node,bindings)
      end

      def self.get_mcollective_client()
        Config.mcollective_client()
      end

      # TODO: change signature to def self.async_execution(task_idh,top_task_idh,config_node,callbacks,context)
      def self.initiate_execution(task_idh,top_task_idh,config_node,opts)
        version_context = get_version_context(config_node)
        config_agent = ConfigAgent.load(config_node[:config_agent_type])

        opts_ret_msg = Hash.new
        if assembly_id = config_node[:assembly_idh][:guid]
          assembly = assembly_id && task_idh.createIDH(:model_name => :assembly_instance,:id => assembly_id).create_object()
          opts_ret_msg.merge!(:assembly => assembly)
        end
        msg_content = config_agent.ret_msg_content(config_node,opts_ret_msg)

        agent_git_details = { :repo => "dtk-node-agent", :branch => "" }
        msg_content.merge!( :task_id => task_idh.get_id(),
                            :top_task_id => top_task_idh.get_id(), 
                            :version_context => version_context, 
                            :agent_git_details => agent_git_details,
                            # TODO: not doing at this point puppet version per run; it just can be set when node is created
                            :puppet_version => config_node[:node][:puppet_version]
                          )
        pbuilderid = Node.pbuilderid(config_node[:node])
        filter = filter_single_fact("pbuilderid",pbuilderid)
        context = opts[:receiver_context]<commit_msg>fixed bug with adding service name on node groups<commit_after>require 'mcollective'
r8_nested_require('mcollective','monkey_patches')
module DTK
  module CommandAndControlAdapter
    class Mcollective < CommandAndControlNodeConfig
      r8_nested_require('mcollective','assembly_action')
      r8_nested_require('mcollective','multiplexer')
      r8_nested_require('mcollective','config')
      extend AssemblyActionClassMixin
      def self.server_host()
        R8::Config[:command_and_control][:node_config][:mcollective][:host]
      end

      def self.discover(filter, timeout, limit, client)
        Config.discover(filter, timeout, limit, client)
      end

      def self.install_script(node,bindings)
        Config.install_script(node,bindings)
      end

      def self.get_mcollective_client()
        Config.mcollective_client()
      end

      # TODO: change signature to def self.async_execution(task_idh,top_task_idh,config_node,callbacks,context)
      def self.initiate_execution(task_idh,top_task_idh,config_node,opts)
        version_context = get_version_context(config_node)
        config_agent = ConfigAgent.load(config_node[:config_agent_type])

        opts_ret_msg = Hash.new
        if assembly_id = (config_node[:assembly_idh]||{})[:guid]
          assembly = assembly_id && task_idh.createIDH(:model_name => :assembly_instance,:id => assembly_id).create_object()
          opts_ret_msg.merge!(:assembly => assembly)
        end
        msg_content = config_agent.ret_msg_content(config_node,opts_ret_msg)

        agent_git_details = { :repo => "dtk-node-agent", :branch => "" }
        msg_content.merge!( :task_id => task_idh.get_id(),
                            :top_task_id => top_task_idh.get_id(), 
                            :version_context => version_context, 
                            :agent_git_details => agent_git_details,
                            # TODO: not doing at this point puppet version per run; it just can be set when node is created
                            :puppet_version => config_node[:node][:puppet_version]
                          )
        pbuilderid = Node.pbuilderid(config_node[:node])
        filter = filter_single_fact("pbuilderid",pbuilderid)
        context = opts[:receiver_context]
{'fraction_non_alphanumeric': 0.09523809523809523, 'fraction_numerical': 0.0022251891410769915, 'mean_word_length': 3.009812667261374, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '3229472', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1304, 'n_words': 215}