Add more logging for execution requests

This commit is contained in:
Sebastian Serth
2021-11-18 14:18:41 +01:00
parent c90e02e4f1
commit 5aee2aaba8
2 changed files with 3 additions and 0 deletions

View File

@ -53,6 +53,7 @@ class Runner < ApplicationRecord
end
def attach_to_execution(command, &block)
Rails.logger.debug { "#{Time.zone.now.getutc.inspect}: Starting execution with Runner #{id} for #{user_type} #{user_id}." }
starting_time = Time.zone.now
begin
# As the EventMachine reactor is probably shared with other threads, we cannot use EventMachine.run with
@ -68,6 +69,7 @@ class Runner < ApplicationRecord
e.execution_duration = Time.zone.now - starting_time
raise
end
Rails.logger.debug { "#{Time.zone.now.getutc.inspect}: Stopped execution with Runner #{id} for #{user_type} #{user_id}." }
Time.zone.now - starting_time # execution duration
end

View File

@ -199,6 +199,7 @@ class Submission < ApplicationRecord
runner = Runner.for(user, exercise.execution_environment)
files = collect_files
files.reject!(&:teacher_defined_assessment?) if cause == 'run'
Rails.logger.debug { "#{Time.zone.now.getutc.inspect}: Copying files to Runner #{runner.id} for #{user_type} #{user_id} and Submission #{id}." }
runner.copy_files(files)
rescue Runner::Error => e
e.waiting_duration = Time.zone.now - request_time