From 34a7fd27176b928dc8e0653be0e1984bc86cbb4b Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.anjos@idiap.ch> Date: Mon, 23 May 2016 13:11:49 +0200 Subject: [PATCH] [experiments] Allow users to change experiments that were partially run --- beat/web/experiments/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/beat/web/experiments/models.py b/beat/web/experiments/models.py index c9480bc1d..67af2255b 100644 --- a/beat/web/experiments/models.py +++ b/beat/web/experiments/models.py @@ -549,10 +549,13 @@ class Experiment(Shareable): # Ties the block in slots = job_description.get('nb_slots') - b, _ = Block.objects.get_or_create(experiment=self, - name=block_name, algorithm=algorithm) + b = Block.objects.filter(experiment=self, name=block_name).first() + if b is None: + b = Block(experiment=self, name=block_name, algorithm=algorithm) + else: + b.algorithm = algorithm b.command=simplejson.dumps(job_description, indent=4) - b.status=Block.NOT_CACHED if (self.status == Experiment.PENDING) else b.status + b.status=Block.NOT_CACHED b.analyzer=algorithm.analysis() b.environment=env b.queue=queue -- GitLab