From 1ab04fc0e7bfa4e4c130dc1d1752da09cfaa5dc1 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Tue, 26 Apr 2016 23:29:41 +0200
Subject: [PATCH] [experiments] Reject scheduling of experiments with unset
 queue/environment

---
 beat/web/experiments/models.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/beat/web/experiments/models.py b/beat/web/experiments/models.py
index 63cf7294c..f28b9a0e8 100644
--- a/beat/web/experiments/models.py
+++ b/beat/web/experiments/models.py
@@ -985,6 +985,21 @@ class Block(models.Model):
 
         if self.status != Block.NOT_CACHED: return
 
+        # checks queue and environment
+        if self.queue is None:
+            raise RuntimeError("Block `%s' does not have a queue assigned " \
+                "- this normally indicates the originally selected " \
+                "queue was deleted since the experiment was first " \
+                "configured. Re-configure this experiment and select a new " \
+                "default or block-specific queue" % self.name)
+
+        if self.environment is None:
+            raise RuntimeError("Block `%s' does not have an environment " \
+                "assigned - this normally indicates the originally selected " \
+                "environment was deleted since the experiment was first " \
+                "configured. Re-configure this experiment and select a new " \
+                "default or block-specific environment" % self.name)
+
         from ..backend.models import Job
 
         # search for other jobs with similar outputs and has no children yet
-- 
GitLab