Commit 71493cf7 authored by Philip ABBET's avatar Philip ABBET
Browse files

[backend] Add back the transaction decorators (needed for select_for_update)

parent 2bdb0d35
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
############################################################################### ###############################################################################
from django.conf import settings from django.conf import settings
from django.db import transaction
from django.db.models import Count from django.db.models import Count
from django.db.models import Q from django.db.models import Q
...@@ -54,6 +55,7 @@ import beat.core.algorithm ...@@ -54,6 +55,7 @@ import beat.core.algorithm
from beat.core.utils import NumpyJSONEncoder from beat.core.utils import NumpyJSONEncoder
@transaction.atomic
def schedule_experiment(experiment): def schedule_experiment(experiment):
'''Schedules the experiment for execution at the backend '''Schedules the experiment for execution at the backend
...@@ -133,6 +135,7 @@ def schedule_experiment(experiment): ...@@ -133,6 +135,7 @@ def schedule_experiment(experiment):
#---------------------------------------------------------- #----------------------------------------------------------
@transaction.atomic
def cancel_experiment(experiment): def cancel_experiment(experiment):
'''Cancel the execution of the experiment on the backend '''Cancel the execution of the experiment on the backend
...@@ -556,6 +559,7 @@ def retrieve_candidate_splits_for_queue(queue): ...@@ -556,6 +559,7 @@ def retrieve_candidate_splits_for_queue(queue):
#---------------------------------------------------------- #----------------------------------------------------------
@transaction.atomic
def assign_split_to_worker(split, worker): def assign_split_to_worker(split, worker):
'''Schedules the split to be executed on a given worker''' '''Schedules the split to be executed on a given worker'''
...@@ -572,6 +576,7 @@ def assign_split_to_worker(split, worker): ...@@ -572,6 +576,7 @@ def assign_split_to_worker(split, worker):
#---------------------------------------------------------- #----------------------------------------------------------
@transaction.atomic
def mark_similar_jobs_as_mirror(job): def mark_similar_jobs_as_mirror(job):
'''Mark all similar jobs as mirror, and delete their job splits''' '''Mark all similar jobs as mirror, and delete their job splits'''
...@@ -898,6 +903,7 @@ def cancel_all_blocks(experiment): ...@@ -898,6 +903,7 @@ def cancel_all_blocks(experiment):
#---------------------------------------------------------- #----------------------------------------------------------
@transaction.atomic
def update_experiment(experiment): def update_experiment(experiment):
experiment = Experiment.objects.select_for_update().get(pk=experiment.pk) experiment = Experiment.objects.select_for_update().get(pk=experiment.pk)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment