From 78e05b6597ae899390d58ee9c5073d573fe0538f Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Tue, 19 Sep 2023 15:35:51 +0200 Subject: [PATCH] Fix docker nimages not being shut down --- app/runners/submission_runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/runners/submission_runner.rb b/app/runners/submission_runner.rb index b3342a502b..7e7b4a7a69 100644 --- a/app/runners/submission_runner.rb +++ b/app/runners/submission_runner.rb @@ -164,7 +164,7 @@ def execute while Time.zone.now - before_time < time_limit before_stats = Time.zone.now # Check if container is still running - if !Rails.env.test? && (Docker::Container.any? { |c| c.id.starts_with?(container.id) || container.id.starts_with?(container.id) } && container.refresh!.info['State']['Running']) + if !Rails.env.test? && (Docker::Container.all.any? { |c| c.id.starts_with?(container.id) || container.id.starts_with?(container.id) } && container.refresh!.info['State']['Running']) # rubocop:disable Rails/RedundantActiveRecordAllMethod # If we don't pass these extra options gathering stats takes 1+ seconds (https://github.com/moby/moby/issues/23188#issuecomment-223211481) stats = container.stats({ 'one-shot': true, stream: false }) memory = [stats['memory_stats']['usage'] / (1024.0 * 1024.0), memory].max if stats['memory_stats']&.fetch('usage', nil)