##// END OF EJS Templates
Scheduler funcional
Renato Huallpa -
r395:cfb0f9955b15
parent child
Show More
@@ -18,8 +18,8 TZ=America/Lima
18 DOCKER_DATA=/data/dockers/radarsys/
18 DOCKER_DATA=/data/dockers/radarsys/
19 LOCAL_IP=192.168.1.128
19 LOCAL_IP=192.168.1.128
20
20
21 # MQTT_SERVER=10.10.10.200
21 MQTT_SERVER=10.10.10.200
22 MQTT_SERVER = 192.168.100.5
22 # MQTT_SERVER = 192.168.100.5
23 MQTT_PORT = 1883
23 MQTT_PORT = 1883
24 MQTT_KEEPALIVE = 3660
24 MQTT_KEEPALIVE = 3660
25
25
@@ -115,6 +115,11 class ATRADConfiguration(Configuration):
115 if self.device.status == 2: #Configured
115 if self.device.status == 2: #Configured
116 self.message = 'TX device is already stopped.'
116 self.message = 'TX device is already stopped.'
117 return False
117 return False
118
119 # Se crea el modo ocupado para una vez inicia el STOP
120 self.device.status = 5
121 self.device.save()
122 # Por si se demora deteniendo, que su estado sea busy
118
123
119 post_data = {"topic":0}
124 post_data = {"topic":0}
120 route = "http://" + str(ip) + ":" + str(port) + "/write/"
125 route = "http://" + str(ip) + ":" + str(port) + "/write/"
@@ -85,6 +85,11 class CGSConfiguration(Configuration):
85 if self.device.status == 2: #Configured
85 if self.device.status == 2: #Configured
86 self.message = 'CGS device is already stopped.'
86 self.message = 'CGS device is already stopped.'
87 return False
87 return False
88
89 # Se crea el modo ocupado para una vez inicia el STOP
90 self.device.status = 5
91 self.device.save()
92 # Por si se demora deteniendo, que su estado sea busy
88
93
89 post_data = {"freq0":0, "freq1":0, "freq2":0, "freq3":0}
94 post_data = {"freq0":0, "freq1":0, "freq2":0, "freq3":0}
90 route = "http://" + str(ip) + ":" + str(port) + "/write/"
95 route = "http://" + str(ip) + ":" + str(port) + "/write/"
@@ -113,6 +113,11 class DDSConfiguration(Configuration):
113
113
114 def stop_device(self):
114 def stop_device(self):
115
115
116 # Se crea el modo ocupado para una vez inicia el STOP
117 self.device.status = 5
118 self.device.save()
119 # Por si se demora deteniendo, que su estado sea busy
120
116 try:
121 try:
117 answer = api.disable_rf(ip = self.device.ip_address,
122 answer = api.disable_rf(ip = self.device.ip_address,
118 port = self.device.port_address)
123 port = self.device.port_address)
@@ -139,6 +139,11 class DDSRestConfiguration(Configuration):
139
139
140 def stop_device(self):
140 def stop_device(self):
141
141
142 # Se crea el modo ocupado para una vez inicia el STOP
143 self.device.status = 5
144 self.device.save()
145 # Por si se demora deteniendo, que su estado sea busy
146
142 try:
147 try:
143 payload = self.request('stop', 'post',data=json.dumps({'_rf_enable':0}))
148 payload = self.request('stop', 'post',data=json.dumps({'_rf_enable':0}))
144 self.message = 'DDS REST: {}'.format(payload['stop'])
149 self.message = 'DDS REST: {}'.format(payload['stop'])
@@ -286,6 +286,11 class JARSConfiguration(Configuration):
286
286
287 def stop_device(self):
287 def stop_device(self):
288
288
289 # Se crea el modo ocupado para una vez inicia el STOP
290 self.device.status = 5
291 self.device.save()
292 # Por si se demora deteniendo, que su estado sea busy
293
289 try:
294 try:
290 payload = self.request('stop', 'post')
295 payload = self.request('stop', 'post')
291 self.device.status = payload['status']
296 self.device.status = payload['status']
@@ -83,6 +83,7 EXP_STATES = (
83 (2,'Running'), #GREEN
83 (2,'Running'), #GREEN
84 (3,'Scheduled'), #BLUE
84 (3,'Scheduled'), #BLUE
85 (4,'Unknown'), #WHITE
85 (4,'Unknown'), #WHITE
86 (5,'Busy'),
86 )
87 )
87
88
88 CONF_TYPES = (
89 CONF_TYPES = (
@@ -427,7 +428,7 class Experiment(models.Model):
427 '''
428 '''
428 self.status=5 #Busy
429 self.status=5 #Busy
429 self.save()
430 self.save()
430 # print("Guardando STATUS: {}".format(self.status))
431 print("Realizando operación. \nEXPERIMENT STATUS : {}".format(self.status))
431
432
432 confs = []
433 confs = []
433 allconfs = Configuration.objects.filter(experiment=self, type = 0).order_by('-device__device_type__sequence')
434 allconfs = Configuration.objects.filter(experiment=self, type = 0).order_by('-device__device_type__sequence')
@@ -442,10 +443,8 class Experiment(models.Model):
442
443
443
444
444 for conf in confs:
445 for conf in confs:
445 print("conf->",conf)
446 print(conf.device)
447 print(conf.device.status)
448 print("--------------",flush=True)
446 print("--------------",flush=True)
447 print("STATUS: {}".format(conf.device.status))
449 print("Stop ",conf.name,flush=True)
448 print("Stop ",conf.name,flush=True)
450 if conf.stop_device() ==False:
449 if conf.stop_device() ==False:
451 print("Falló Stop ",conf.name)
450 print("Falló Stop ",conf.name)
@@ -817,6 +816,7 class Configuration(PolymorphicModel):
817 return reverse('url_%s_conf' % self.device.device_type.name, args=[str(self.id)])
816 return reverse('url_%s_conf' % self.device.device_type.name, args=[str(self.id)])
818
817
819 def get_absolute_mqtt_url(self):
818 def get_absolute_mqtt_url(self):
819 print("----------------- {} ----------------------".format(self.device.device_type.name),flush=True)
820 if self.device.device_type.name=='abs':
820 if self.device.device_type.name=='abs':
821 return reverse('url_%s_conf_mqtt' % self.device.device_type.name, args=[str(self.id)])
821 return reverse('url_%s_conf_mqtt' % self.device.device_type.name, args=[str(self.id)])
822 else:
822 else:
@@ -40,7 +40,7
40 {% endfor%}
40 {% endfor%}
41 </tr>
41 </tr>
42 {% for object in objects %}
42 {% for object in objects %}
43 <tr class="clickable-row" data-href="{{object.get_absolute_mqtt_url}}">
43 <tr class="clickable-row" data-href="{{object.get_absolute_url}}">
44 <td>{{ forloop.counter|add:offset }}</td>
44 <td>{{ forloop.counter|add:offset }}</td>
45 {% for key in keys %}
45 {% for key in keys %}
46 {% if key == 'actions' %}
46 {% if key == 'actions' %}
@@ -65,7 +65,7
65 {% endfor%}
65 {% endfor%}
66 </tr>
66 </tr>
67 {% for item in experiments %}
67 {% for item in experiments %}
68 <tr class="clickable-row" data-href="{% url 'url_experiment' item.id %}">
68 <tr class="clickable-row" s data-href="{% url 'url_experiment' item.id %}">
69 <td>{{ forloop.counter }}</td>
69 <td>{{ forloop.counter }}</td>
70 {% for key in experiment_keys %}
70 {% for key in experiment_keys %}
71 <td>{{ item|attr:key }}</td>
71 <td>{{ item|attr:key }}</td>
@@ -510,7 +510,10 class RCConfiguration(Configuration):
510 return True
510 return True
511
511
512 def stop_device(self):
512 def stop_device(self):
513
513 # Se crea el modo ocupado para una vez inicia el STOP
514 self.device.status = 5
515 self.device.save()
516 # Por si se demora deteniendo, que su estado sea busy
514 try:
517 try:
515 payload = self.request('stop', 'post')
518 payload = self.request('stop', 'post')
516 self.message = 'RC stop: {}'.format(payload['stop'])
519 self.message = 'RC stop: {}'.format(payload['stop'])
General Comments 0
You need to be logged in to leave comments. Login now