<commit_before>class PrepareBenchmarkExecutionJob < Struct.new(:benchmark_definition_id, :benchmark_execution_id)
  def perform
    puts "Preparing benchmark with id #{benchmark_definition_id}"
    benchmark_definition = BenchmarkDefinition.find(benchmark_definition_id)
    benchmark_execution = BenchmarkExecution.find(benchmark_execution_id)

    benchmark_execution.start_time = Time.now
    benchmark_definition.save

    %x( cd "#{benchmark_definition.vagrant_directory_path}";
        vagrant up )
    # TODO: Handle stdout, stderr redirection into a logging directory (not . due to vagrant sync, which may result in an endless loop) and exit_code

    benchmark_execution.end_time = Time.now
    benchmark_execution.save
  end
end<commit_msg>Add BenchmarkExecution status update and fix mixing up execution and definition on save<commit_after>class PrepareBenchmarkExecutionJob < Struct.new(:benchmark_definition_id, :benchmark_execution_id)
  def perform
    puts "Preparing benchmark with id #{benchmark_definition_id}"
    benchmark_definition = BenchmarkDefinition.find(benchmark_definition_id)
    benchmark_execution = BenchmarkExecution.find(benchmark_execution_id)

    benchmark_execution.status = 'PREPARING'
    benchmark_execution.start_time = Time.now
    benchmark_execution.save

    %x( cd "#{benchmark_definition.vagrant_directory_path}";
        vagrant up )
    # TODO: Handle stdout, stderr redirection into a logging directory (not . due to vagrant sync, which may result in an endless loop) and exit_code

    benchmark_execution.end_time = Time.now
    benchmark_execution.status = 'WAITING'
    benchmark_execution.save
  end
end
{'fraction_non_alphanumeric': 0.06261288380493679, 'fraction_numerical': 0.0, 'mean_word_length': 5.132841328413284, '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': '6191135', 'n_tokens_mistral': 496, 'n_tokens_neox': 469, 'n_words': 119}