Skip to content

Commit

Permalink
Merge branch 'hotfix/6.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Apr 18, 2023
2 parents 148f6b9 + 6bf26be commit 9fea932
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions app/runners/submission_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def copy_or_create(from, to)
end

def prepare
@start = Time.zone.now
# set the submission's status
@submission.status = 'running'
@submission.save
Expand All @@ -82,6 +83,10 @@ def prepare
copy_or_create(@exercise.full_path.join('workdir'), @mountsrc.join('workdir'))
copy_or_create(@exercise.full_path.join('evaluation'), @mountsrc.join(@hidden_path, 'resources'))
copy_or_create(@judge.full_path, @mountsrc.join(@hidden_path, 'judge'))

end_preparing = Time.zone.now
@time_messages = []
@time_messages << build_message(format('<strong>Prepare:</strong> %<time>.2f seconds', time: (end_preparing - @start)), 'zeus', 'html')
end

def execute
Expand Down Expand Up @@ -214,10 +219,16 @@ def execute
]
end

@time_messages << build_message(format('<strong>Runtime:</strong> %<time>.2f seconds', time: (after_time - before_time)), 'zeus', 'html')

result = begin
start_rc = Time.zone.now
rc = ResultConstructor.new @submission.user.lang
rc.feed(stdout.force_encoding('utf-8'))
rc.result(timeout)
result = rc.result(timeout)
end_rc = Time.zone.now
@time_messages << build_message(format('<strong>Result construction:</strong> %<time>.2f seconds', time: (end_rc - start_rc)), 'zeus', 'html')
result
rescue ResultConstructorError => e
if [134, 137, 143].include? exit_status
description = timeout ? 'time limit exceeded' : 'memory limit exceeded'
Expand All @@ -237,7 +248,6 @@ def execute

result[:messages] ||= []
result[:messages] << build_message("<strong>Worker:</strong> #{`hostname`.strip}", 'zeus', 'html')
result[:messages] << build_message(format('<strong>Runtime:</strong> %<time>.2f seconds', time: (after_time - before_time)), 'zeus', 'html')
result[:messages] << build_message(format('<strong>Memory usage:</strong> %<memory>.2f MiB', memory: memory), 'zeus', 'html')
result
end
Expand All @@ -247,9 +257,13 @@ def add_runtime_metrics(result); end
def finalize
return if @mountsrc.nil?

start_final = Time.zone.now

# remove path on file system used as temporary working directory for processing the submission
FileUtils.remove_entry_secure(@mountsrc, verbose: true)
@mountsrc = nil
end_final = Time.zone.now
@time_messages << build_message(format('<strong>Finalize:</strong> %<time>.2f seconds', time: (end_final - start_final)), 'zeus', 'html')
end

def run
Expand All @@ -261,6 +275,8 @@ def run
]
ensure
finalize
@time_messages << build_message(format('<strong>Total time:</strong> %<time>.2f seconds', time: (Time.zone.now - @start)), 'zeus', 'html')
result[:messages]&.concat @time_messages
result
end

Expand Down
2 changes: 1 addition & 1 deletion config/initializers/00_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Application
module Version
MAJOR = 6
MINOR = 7
PATCH = 1
PATCH = 2

STRING = [MAJOR, MINOR, PATCH].compact.join('.')
end
Expand Down

0 comments on commit 9fea932

Please sign in to comment.