<commit_before># @!group /containers/service/:service_name
# @method engine_export_persistent_service_data
# @overload get '/v0/containers/service/:service_name/export'
# exports the service data as a gzip
# @return [Binary]
get '/v0/containers/service/:service_name/export' do
  begin
    service = get_service(params[:service_name])
#    unless SoftwareServiceDefinition.is_consumer_exportable?(hash)
#         raise EnginesException.new(warning_hash("Cannot export as single service", hash))
#        end 
    content_type 'application/octet-stream'  
    stream do |out|
           service.export_data(out)
         end    
  rescue StandardError => e
    send_encoded_exception(request: request, exception: e)
  end
end

# @method engine_import_persistent_service_data
# @overload put '/v0/containers/service/:service_name/import'
# import the service data gzip optional
# data is streamed as application/octet-stream
# @return [true]
put '/v0/containers/service/:service_name/import' do
  begin
    service = get_service(params[:service_name])
  STDERR.puts('SIN IMPORT')
        return_json(service.import_data(request.env['rack.input']))
   # return_json(service.import_data(request.body)) 
   
  rescue StandardError => e
    send_encoded_exception(request: request, exception: e)
  end
end<commit_msg>dont start stream if service is not ruuning<commit_after># @!group /containers/service/:service_name
# @method engine_export_persistent_service_data
# @overload get '/v0/containers/service/:service_name/export'
# exports the service data as a gzip
# @return [Binary]
get '/v0/containers/service/:service_name/export' do
  begin
    service = get_service(params[:service_name])
#    unless SoftwareServiceDefinition.is_consumer_exportable?(hash)
#         raise EnginesException.new(warning_hash("Cannot export as single service", hash))
#        end 
    raise EnginesException.new(warning_hash('Service not running')) unless service.is_running?
    content_type 'application/octet-stream'  
    stream do |out|
           service.export_data(out)
         end    
  rescue StandardError => e
    send_encoded_exception(request: request, exception: e)
  end
end

# @method engine_import_persistent_service_data
# @overload put '/v0/containers/service/:service_name/import'
# import the service data gzip optional
# data is streamed as application/octet-stream
# @return [true]
put '/v0/containers/service/:service_name/import' do
  begin
    service = get_service(params[:service_name])
  STDERR.puts('SIN IMPORT')
        return_json(service.import_data(request.env['rack.input']))
   # return_json(service.import_data(request.body)) 
   
  rescue StandardError => e
    send_encoded_exception(request: request, exception: e)
  end
end
{'fraction_non_alphanumeric': 0.10229341099381144, 'fraction_numerical': 0.0029122679286494356, 'mean_word_length': 4.540322580645161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6196492', 'n_tokens_mistral': 832, 'n_tokens_neox': 837, 'n_words': 184}