<commit_before>module Engines
#  require_relative 'xcon_rset.rb'
  # engines Methods
  def find_engine_service_hash(params)
    SystemDebug.debug(SystemDebug.services,'sm find_engine_service_hash  ', params)
    r = 'engine/service'
    r += address_params(params,[:container_type,:parent_engine,:service_handle,:type_path] )

       rest_get(r)
    rescue StandardError => e
       STDERR.puts( 'Failed To engine/service/ ' + params.to_s)
        SystemUtils.log_exception(e)
      
  end

  def find_engine_services_hashes(params)
  #  rest_get('engine/services/',{:params => params })
  r = 'engine/services'  
    r += address_params(params,[:container_type,:parent_engine,:type_path] )
      #+ params[:container_type] + '/' + params[:parent_engine] 
    #r += '/' + params[:type_path] if params.key?(:type_path)
    rest_get(r)
    rescue StandardError => e
       STDERR.puts( 'Failed To engine/services ' + params.to_s)
        SystemUtils.log_exception(e)
      
  end

  def get_engine_nonpersistent_services(params)
    params[:persistent] = false
      r = 'engine/services/nonpersistent'
    r += address_params(params,[:container_type,:parent_engine])
    rest_get(r)
    rescue StandardError => e
       STDERR.puts( 'Failed To engine/services/nonpersistent/  ' + params.to_s)
        SystemUtils.log_exception(e)
      
  end

  def get_engine_persistent_services(params)
    params[:persistent] = true
   r =  'engine/services/persistent' 
    r += address_params(params,[:container_type,:parent_engine])
    rest_get(r)
    rescue StandardError => e
       STDERR.puts( 'Failed To engine/services/persistent/  ' + params.to_s)
        SystemUtils.log_exception(e)
      
  end

  def add_to_managed_engines_registry(service_hash)
    SystemDebug.debug(SystemDebug.services,'sm add_to_managed_engines_registry ', service_hash)
   # :container_type/:parent_engine/:service_handle/:publisher_namespace/:type_path
    r = 'engine/services/add'
   r += address_params(service_hash,[:parent_engine,:container_type,:service_handle,:publisher_namespace,:type_path])
#    r += '/' + service_hash[:container_type]
#    r += '/' + service_hash[:parent_engine]
#    r += '/' + service_hash[:service_handle]
#    r += '/' + service_hash[:publisher_namespace]
#    r += '/' + service_hash[:type_path]
    rest_post(r,{:api_vars => service_hash} )
  rescue StandardError => e
    STDERR.puts( 'Failed To engine/services/add  ' + service_hash.to_s)
     SystemUtils.log_exception(e)
  end

  def remove_from_managed_engines_registry(params)
      params[:container_type] = 'container' unless params.key?(:container_type) || 
    r = 'engine/services/del'
        addr = address_params(params,[:parent_engine,:container_type,:service_handle,:publisher_namespace,:type_path])
          
        STDERR.puts('ADDR ' + addr.to_s)
        r += addr
#    + params[:container_type] + '/' + params[:parent_engine]       
#    r += '/' + params[:service_handle]
#        r += '/' + params[:publisher_namespace]
#          r += '/' + params[:type_path] 
    rest_delete(r) 
   # rest_delete('engine/services/del',{:params => params })
        rescue StandardError => e
           STDERR.puts( 'Failed To engine/services/del/  ' + params.to_s)
            SystemUtils.log_exception(e)
          
  end<commit_msg>rehaving wierd<commit_after>module Engines
#  require_relative 'xcon_rset.rb'
  # engines Methods
  def find_engine_service_hash(params)
    SystemDebug.debug(SystemDebug.services,'sm find_engine_service_hash  ', params)
    r = 'engine/service'
    r += address_params(params,[:container_type,:parent_engine,:service_handle,:type_path] )

       rest_get(r)
    rescue StandardError => e
       STDERR.puts( 'Failed To engine/service/ ' + params.to_s)
        SystemUtils.log_exception(e)
      
  end

  def find_engine_services_hashes(params)
  #  rest_get('engine/services/',{:params => params })
  r = 'engine/services'  
    r += address_params(params,[:container_type,:parent_engine,:type_path] )
      #+ params[:container_type] + '/' + params[:parent_engine] 
    #r += '/' + params[:type_path] if params.key?(:type_path)
    rest_get(r)
    rescue StandardError => e
       STDERR.puts( 'Failed To engine/services ' + params.to_s)
        SystemUtils.log_exception(e)
      
  end

  def get_engine_nonpersistent_services(params)
    params[:persistent] = false
      r = 'engine/services/nonpersistent'
    r += address_params(params,[:container_type,:parent_engine])
    rest_get(r)
    rescue StandardError => e
       STDERR.puts( 'Failed To engine/services/nonpersistent/  ' + params.to_s)
        SystemUtils.log_exception(e)
      
  end

  def get_engine_persistent_services(params)
    params[:persistent] = true
   r =  'engine/services/persistent' 
    r += address_params(params,[:container_type,:parent_engine])
    rest_get(r)
    rescue StandardError => e
       STDERR.puts( 'Failed To engine/services/persistent/  ' + params.to_s)
        SystemUtils.log_exception(e)
      
  end

  def add_to_managed_engines_registry(service_hash)
    SystemDebug.debug(SystemDebug.services,'sm add_to_managed_engines_registry ', service_hash)
   # :container_type/:parent_engine/:service_handle/:publisher_namespace/:type_path
    r = 'engine/services/add'
   r += address_params(service_hash,[:parent_engine,:container_type,:service_handle,:publisher_namespace,:type_path])
#    r += '/' + service_hash[:container_type]
#    r += '/' + service_hash[:parent_engine]
#    r += '/' + service_hash[:service_handle]
#    r += '/' + service_hash[:publisher_namespace]
#    r += '/' + service_hash[:type_path]
    rest_post(r,{:api_vars => service_hash} )
  rescue StandardError => e
    STDERR.puts( 'Failed To engine/services/add  ' + service_hash.to_s)
     SystemUtils.log_exception(e)
  end

  def remove_from_managed_engines_registry(params)
      params[:container_type] = 'container' unless params.key?(:container_type) || 
        r = 'engine/services/del' + address_params(params,[:parent_engine,:container_type,:service_handle,:publisher_namespace,:type_path])
          
        STDERR.puts('ADDR ' + r.to_s)
        #       r += addr
#    + params[:container_type] + '/' + params[:parent_engine]       
#    r += '/' + params[:service_handle]
#        r += '/' + params[:publisher_namespace]
#          r += '/' + params[:type_path] 
    rest_delete(r) 
   # rest_delete('engine/services/del',{:params => params })
        rescue StandardError => e
           STDERR.puts( 'Failed To engine/services/del/  ' + params.to_s)
            SystemUtils.log_exception(e)
          
  end
{'fraction_non_alphanumeric': 0.13096139288417866, 'fraction_numerical': 0.0, 'mean_word_length': 3.6195804195804198, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '369522', 'n_tokens_mistral': 2193, 'n_tokens_neox': 2171, 'n_words': 311}