@@ -19,7 +19,7 except ImportError: | |||||
19 | from .forms import CampaignForm, ExperimentForm, DeviceForm, ConfigurationForm, LocationForm, UploadFileForm, DownloadFileForm, OperationForm, NewForm |
|
19 | from .forms import CampaignForm, ExperimentForm, DeviceForm, ConfigurationForm, LocationForm, UploadFileForm, DownloadFileForm, OperationForm, NewForm | |
20 | from .forms import OperationSearchForm, FilterForm, ChangeIpForm |
|
20 | from .forms import OperationSearchForm, FilterForm, ChangeIpForm | |
21 |
|
21 | |||
22 | from .tasks import task_start, task_stop |
|
22 | from .tasks import task_start, task_stop, task_status | |
23 |
|
23 | |||
24 | from apps.rc.forms import RCConfigurationForm, RCLineCode, RCMixConfigurationForm |
|
24 | from apps.rc.forms import RCConfigurationForm, RCLineCode, RCMixConfigurationForm | |
25 | from apps.dds.forms import DDSConfigurationForm |
|
25 | from apps.dds.forms import DDSConfigurationForm | |
@@ -737,10 +737,12 def experiment_start(request, id_exp): | |||||
737 | else: |
|
737 | else: | |
738 | task = task_start.delay(exp.pk) |
|
738 | task = task_start.delay(exp.pk) | |
739 | exp.status = task.wait() |
|
739 | exp.status = task.wait() | |
|
740 | ||||
740 | if exp.status==0: |
|
741 | if exp.status==0: | |
741 | messages.error(request, 'Experiment {} not start'.format(exp)) |
|
742 | messages.error(request, 'Experiment {} not start'.format(exp)) | |
742 | if exp.status==2: |
|
743 | if exp.status==2: | |
743 | messages.success(request, 'Experiment {} started'.format(exp)) |
|
744 | messages.success(request, 'Experiment {} started'.format(exp)) | |
|
745 | task_status.delay(exp.pk) #background get_status function | |||
744 | exp.save() |
|
746 | exp.save() | |
745 |
|
747 | |||
746 | return redirect(exp.get_absolute_url()) |
|
748 | return redirect(exp.get_absolute_url()) | |
@@ -756,7 +758,7 def experiment_stop(request, id_exp): | |||||
756 | return redirect(exp.get_absolute_url()) |
|
758 | return redirect(exp.get_absolute_url()) | |
757 |
|
759 | |||
758 | exp.get_status() |
|
760 | exp.get_status() | |
759 |
|
761 | |||
760 | if exp.status == 2: |
|
762 | if exp.status == 2: | |
761 | task = task_stop.delay(exp.pk) |
|
763 | task = task_stop.delay(exp.pk) | |
762 | exp.status = task.wait() |
|
764 | exp.status = task.wait() |
General Comments 0
You need to be logged in to leave comments.
Login now