From 71493cf7a387bfa890a335e66c3521c3a6452703 Mon Sep 17 00:00:00 2001
From: Philip ABBET <philip.abbet@idiap.ch>
Date: Mon, 23 Oct 2017 13:43:57 +0200
Subject: [PATCH] [backend] Add back the transaction decorators (needed for
 select_for_update)

---
 beat/web/backend/helpers.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/beat/web/backend/helpers.py b/beat/web/backend/helpers.py
index ab2100a66..0fd425d65 100755
--- a/beat/web/backend/helpers.py
+++ b/beat/web/backend/helpers.py
@@ -26,6 +26,7 @@
 ###############################################################################
 
 from django.conf import settings
+from django.db import transaction
 from django.db.models import Count
 from django.db.models import Q
 
@@ -54,6 +55,7 @@ import beat.core.algorithm
 from beat.core.utils import NumpyJSONEncoder
 
 
+@transaction.atomic
 def schedule_experiment(experiment):
     '''Schedules the experiment for execution at the backend
 
@@ -133,6 +135,7 @@ def schedule_experiment(experiment):
 #----------------------------------------------------------
 
 
+@transaction.atomic
 def cancel_experiment(experiment):
     '''Cancel the execution of the experiment on the backend
 
@@ -556,6 +559,7 @@ def retrieve_candidate_splits_for_queue(queue):
 #----------------------------------------------------------
 
 
+@transaction.atomic
 def assign_split_to_worker(split, worker):
     '''Schedules the split to be executed on a given worker'''
 
@@ -572,6 +576,7 @@ def assign_split_to_worker(split, worker):
 #----------------------------------------------------------
 
 
+@transaction.atomic
 def mark_similar_jobs_as_mirror(job):
     '''Mark all similar jobs as mirror, and delete their job splits'''
 
@@ -898,6 +903,7 @@ def cancel_all_blocks(experiment):
 #----------------------------------------------------------
 
 
+@transaction.atomic
 def update_experiment(experiment):
     experiment = Experiment.objects.select_for_update().get(pk=experiment.pk)
 
-- 
GitLab