-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory stats collection during submission running #4807
Conversation
468a63a
to
9b92b55
Compare
app/runners/submission_runner.rb
Outdated
memory = stats['memory_stats']['max_usage'] / (1024.0 * 1024.0) if stats['memory_stats']&.fetch('max_usage', nil) | ||
before_stats = Time.zone.now | ||
# Check if container is still running | ||
if !Rails.env.test? && (Docker::Container.all.select { |c| c.id.starts_with?(container.id) || container.id.starts_with?(container.id) }.any? && container.refresh!.info['State']['Running']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the old guard style here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old guard style is hard to combine with the conditional sleep below.
memory = [stats['memory_stats']['usage'] / (1024.0 * 1024.0), memory].max if stats['memory_stats']&.fetch('usage', nil) | ||
end | ||
|
||
# Gathering stats still takes a long time, so if we spent enough time on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it takes a long time, is there a performance impact (since we now do it 5 times more often)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not noticeably on my machine. The runtime is because docker does some sleeps internally to gather the data, IIUC.
This pull request fixes collection of memory stats during submission running. There were two problems:
memory_stats.max_usage
is only available if docker uses cgroups v1 under the hood. We use v2 on all our hosts.