|
7 | 7 | import json |
8 | 8 |
|
9 | 9 | from Crypto.PublicKey import RSA |
10 | | -from celery.canvas import group |
11 | 10 | from django.contrib.auth.models import AnonymousUser, User |
12 | 11 | from django.utils import timezone |
13 | 12 | from rest_framework import permissions, status, viewsets |
|
18 | 17 |
|
19 | 18 | from api import models |
20 | 19 | from api import serializers |
21 | | -from api import tasks |
22 | 20 |
|
23 | 21 |
|
24 | 22 | class AnonymousAuthentication(BaseAuthentication): |
@@ -200,7 +198,6 @@ def converge(self, request, **kwargs): |
200 | 198 | def destroy(self, request, **kwargs): |
201 | 199 | formation = self.get_object() |
202 | 200 | formation.destroy() |
203 | | - tasks.converge_controller.delay().wait() |
204 | 201 | return Response(status=status.HTTP_204_NO_CONTENT) |
205 | 202 |
|
206 | 203 |
|
@@ -299,8 +296,7 @@ class AppViewSet(OwnerViewSet): |
299 | 296 | def post_save(self, app, created=False, **kwargs): |
300 | 297 | if created: |
301 | 298 | app.build() |
302 | | - group(*[tasks.converge_formation.si(app.formation), # @UndefinedVariable |
303 | | - tasks.converge_controller.si()]).apply_async().join() # @UndefinedVariable |
| 299 | + app.formation.converge(controller=True) |
304 | 300 |
|
305 | 301 | def pre_save(self, app, created=False, **kwargs): |
306 | 302 | if not app.pk and not app.formation.domain and app.formation.app_set.count() > 0: |
@@ -372,8 +368,7 @@ def run(self, request, **kwargs): |
372 | 368 | def destroy(self, request, **kwargs): |
373 | 369 | app = self.get_object() |
374 | 370 | app.destroy() |
375 | | - group(*[tasks.converge_formation.si(app.formation), # @UndefinedVariable |
376 | | - tasks.converge_controller.si()]).apply_async().join() # @UndefinedVariable |
| 371 | + app.formation.converge(controller=True) |
377 | 372 | return Response(status=status.HTTP_204_NO_CONTENT) |
378 | 373 |
|
379 | 374 |
|
|
0 commit comments