From 5e0a13ebe8f0a25bf09de76024687481c81a19fe Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 2 Aug 2018 15:51:01 -0300 Subject: [PATCH] 13773: Filter out running containers that will fail from reuse selection. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- services/api/app/models/container.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb index 4c6cadd1d3..380d4aafbe 100644 --- a/services/api/app/models/container.rb +++ b/services/api/app/models/container.rb @@ -277,9 +277,10 @@ class Container < ArvadosModel return usable end - # Check for Running candidates and return the most likely to finish sooner. + # Check for non-failing Running candidates and return the most likely to finish sooner. log_reuse_info { "checking for state=Running..." } running = candidates.where(state: Running). + where("NOT (runtime_status ? 'error')"). order('progress desc, started_at asc'). limit(1).first if running -- 2.30.2