<commit_before>module ManagedUtilityOnAction
  def on_create(event_hash)
    @container_mutex.synchronize {
      SystemDebug.debug(SystemDebug.container_events, :ON_Create_CALLED, event_hash)
      @container_id = event_hash[:id]
      @out_of_memory = false
      @had_out_memory = false
      save_state
    }
    STDERR.puts('START ' + @container_name.to_s)
    start_container
  end

  def on_stop(what, exit_code = 0)
    @exit_code = exit_code
    @had_out_memory = @out_of_memory
    @out_of_memory = false
    @container_api.save_container_log(self, {max_size: 2048, over_write: true})
    save_state
    destroy_container
  end

end<commit_msg>ensure destroy on stop<commit_after>module ManagedUtilityOnAction
  def on_create(event_hash)
    @container_mutex.synchronize {
      SystemDebug.debug(SystemDebug.container_events, :ON_Create_CALLED, event_hash)
      @container_id = event_hash[:id]
      @out_of_memory = false
      @had_out_memory = false
      save_state
    }
    STDERR.puts('START ' + @container_name.to_s)
    start_container
  end

  def on_stop(what, exit_code = 0)
    @exit_code = exit_code
    @had_out_memory = @out_of_memory
    @out_of_memory = false
    @container_api.save_container_log(self, {max_size: 2048, over_write: true})
  ensure
    save_state
    destroy_container
  end

end
{'fraction_non_alphanumeric': 0.08144796380090498, 'fraction_numerical': 0.007541478129713424, 'mean_word_length': 3.8254545454545457, 'pattern_counts': {'":': 0, '<': 3, '<?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': '15228', 'n_tokens_mistral': 471, 'n_tokens_neox': 460, 'n_words': 79}