@@ -61,6 +61,7 urlpatterns = ( | |||||
61 |
|
61 | |||
62 | url(r'^operation/$', views.operation, name='url_operation'), |
|
62 | url(r'^operation/$', views.operation, name='url_operation'), | |
63 | url(r'^operation/(?P<id_camp>-?\d+)/$', views.operation, name='url_operation'), |
|
63 | url(r'^operation/(?P<id_camp>-?\d+)/$', views.operation, name='url_operation'), | |
|
64 | url(r'^operation/(?P<id_camp>-?\d+)/revoke$', views.revoke_tasks, name='url_operation_revoke'), | |||
64 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/start/$', views.radar_start, name='url_radar_start'), |
|
65 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/start/$', views.radar_start, name='url_radar_start'), | |
65 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/stop/$', views.radar_stop, name='url_radar_stop'), |
|
66 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/stop/$', views.radar_stop, name='url_radar_stop'), | |
66 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/refresh/$', views.radar_refresh, name='url_radar_refresh'), |
|
67 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/refresh/$', views.radar_refresh, name='url_radar_refresh'), |
@@ -1261,7 +1261,7 def parse_mask(l): | |||||
1261 | def dev_confs(request): |
|
1261 | def dev_confs(request): | |
1262 |
|
1262 | |||
1263 | page = request.GET.get('page') |
|
1263 | page = request.GET.get('page') | |
1264 | order = ('programmed_date', ) |
|
1264 | order = ('-programmed_date', ) | |
1265 | filters = request.GET.copy() |
|
1265 | filters = request.GET.copy() | |
1266 | if 'my configurations' in filters: |
|
1266 | if 'my configurations' in filters: | |
1267 | filters.pop('my configurations', None) |
|
1267 | filters.pop('my configurations', None) | |
@@ -1795,10 +1795,10 def radar_start(request, id_camp, id_radar): | |||||
1795 | if start > campaign.end_date or start < campaign.start_date: |
|
1795 | if start > campaign.end_date or start < campaign.start_date: | |
1796 | messages.warning(request, 'Experiment {} out of date'.format(exp)) |
|
1796 | messages.warning(request, 'Experiment {} out of date'.format(exp)) | |
1797 | continue |
|
1797 | continue | |
1798 |
|
1798 | |||
|
1799 | app.control.revoke(exp.task) | |||
|
1800 | ||||
1799 | if now > start and now <= end: |
|
1801 | if now > start and now <= end: | |
1800 | exp.status = 3 |
|
|||
1801 | exp.save() |
|
|||
1802 | task = task_start.delay(exp.id) |
|
1802 | task = task_start.delay(exp.id) | |
1803 | exp.status = task.wait() |
|
1803 | exp.status = task.wait() | |
1804 | if exp.status == 0: |
|
1804 | if exp.status == 0: | |
@@ -1844,21 +1844,38 def radar_refresh(request, id_camp, id_radar): | |||||
1844 | experiments = campaign.get_experiments_by_radar(id_radar)[0]['experiments'] |
|
1844 | experiments = campaign.get_experiments_by_radar(id_radar)[0]['experiments'] | |
1845 |
|
1845 | |||
1846 | i = app.control.inspect() |
|
1846 | i = app.control.inspect() | |
1847 | scheduled = i.scheduled().values[0] |
|
1847 | scheduled = i.scheduled().values()[0] | |
1848 | revoked = i.revoked().values[0] |
|
1848 | revoked = i.revoked().values()[0] | |
1849 |
|
1849 | |||
1850 | for exp in experiments: |
|
1850 | for exp in experiments: | |
1851 | if exp.task in revoked: |
|
1851 | if exp.task in revoked: | |
1852 | exp.status = 1 |
|
1852 | exp.status = 1 | |
1853 | elif exp.task in [t['request']['id'] for t in scheduled if 'task_start' in t['request']['name']]: |
|
|||
1854 | exp.status = 2 |
|
|||
1855 | elif exp.task in [t['request']['id'] for t in scheduled if 'task_stop' in t['request']['name']]: |
|
1853 | elif exp.task in [t['request']['id'] for t in scheduled if 'task_stop' in t['request']['name']]: | |
|
1854 | exp.status = 2 | |||
|
1855 | elif exp.task in [t['request']['id'] for t in scheduled if 'task_start' in t['request']['name']]: | |||
1856 | exp.status = 3 |
|
1856 | exp.status = 3 | |
1857 | else: |
|
1857 | else: | |
1858 | exp.status = 4 |
|
1858 | exp.status = 4 | |
1859 | exp.save() |
|
1859 | exp.save() | |
1860 | return HttpResponseRedirect(reverse('url_operation', args=[id_camp])) |
|
1860 | return HttpResponseRedirect(reverse('url_operation', args=[id_camp])) | |
1861 |
|
1861 | |||
|
1862 | @login_required | |||
|
1863 | def revoke_tasks(request, id_camp): | |||
|
1864 | ||||
|
1865 | i = app.control.inspect() | |||
|
1866 | scheduled = i.scheduled().values()[0] | |||
|
1867 | revoked = i.revoked().values()[0] | |||
|
1868 | ||||
|
1869 | for t in scheduled: | |||
|
1870 | if t['request']['id'] in revoked: | |||
|
1871 | continue | |||
|
1872 | app.control.revoke(t['request']['id']) | |||
|
1873 | exp = Experiment.objects.get(pk=eval(t['request']['args'])[0]) | |||
|
1874 | eta = t['eta'] | |||
|
1875 | task = t['request']['name'].split('.')[-1] | |||
|
1876 | messages.warning(request, 'Scheduled {} at {} for experiment {} revoked'.format(task, eta, exp.name)) | |||
|
1877 | ||||
|
1878 | return HttpResponseRedirect(reverse('url_operation', args=[id_camp])) | |||
1862 |
|
1879 | |||
1863 | def real_time(request): |
|
1880 | def real_time(request): | |
1864 |
|
1881 |
@@ -10,7 +10,7 function str2hz(s){ | |||||
10 |
|
10 | |||
11 |
|
11 | |||
12 | function str2unit(s){ |
|
12 | function str2unit(s){ | |
13 |
var km2unit = (20/3)*(parseFloat($('#id_ |
|
13 | var km2unit = (20/3)*(parseFloat($('#id_frequency').val())/parseFloat($('#id_clock_divider').val())); | |
14 | var ret = ""; |
|
14 | var ret = ""; | |
15 | values = s.split(","); |
|
15 | values = s.split(","); | |
16 | for (i=0; i<values.length; i++) { |
|
16 | for (i=0; i<values.length; i++) { | |
@@ -33,7 +33,7 function str2int(s){ | |||||
33 |
|
33 | |||
34 |
|
34 | |||
35 | function str2km(s){ |
|
35 | function str2km(s){ | |
36 |
var km2unit = (20/3)*(parseFloat($('#id_ |
|
36 | var km2unit = (20/3)*(parseFloat($('#id_frequency').val())/parseFloat($('#id_clock_divider').val())); | |
37 | var ret = ""; |
|
37 | var ret = ""; | |
38 | values = s.split(","); |
|
38 | values = s.split(","); | |
39 | for (i=0; i<values.length; i++) { |
|
39 | for (i=0; i<values.length; i++) { |
@@ -18,7 +18,10 def conf(request, conf_id): | |||||
18 | conf = get_object_or_404(RCConfiguration, pk=conf_id) |
|
18 | conf = get_object_or_404(RCConfiguration, pk=conf_id) | |
19 |
|
19 | |||
20 | lines = RCLine.objects.filter(rc_configuration=conf).order_by('channel') |
|
20 | lines = RCLine.objects.filter(rc_configuration=conf).order_by('channel') | |
21 |
clk = RCClock.objects. |
|
21 | clk = RCClock.objects.filter(rc_configuration=conf).first() | |
|
22 | if clk is None: | |||
|
23 | clk = RCClock(rc_configuration=conf) | |||
|
24 | clk.save() | |||
22 |
|
25 | |||
23 | for line in lines: |
|
26 | for line in lines: | |
24 | params = json.loads(line.params) |
|
27 | params = json.loads(line.params) |
General Comments 0
You need to be logged in to leave comments.
Login now