Commit dd7544dcd54ac577d54e918991c338ac9513c833

Authored by Etienne Pallier
1 parent a760bcc8
Exists in dev

agent_survey : ajout champ iteration

src/core/pyros_django/agent/Agent.py
... ... @@ -436,7 +436,7 @@ class Agent:
436 436 if AgentSurvey.objects.filter(name=self.name).exists():
437 437 self._agent_survey = AgentSurvey.objects.get(name=self.name)
438 438 else:
439   - self._agent_survey = AgentSurvey.objects.create(name=self.name, validity_duration=60, mode=self.mode, status=self.status)
  439 + self._agent_survey = AgentSurvey.objects.create(name=self.name, validity_duration=60, mode=self.mode, status=self.status, iteration=-1)
440 440 self.printd("Agent survey is", self._agent_survey)
441 441  
442 442 ### self._agent_logs = AgentLogs.objects.create(name=self.name, message="Step __init__")
... ... @@ -825,6 +825,7 @@ class Agent:
825 825 #self._agent_survey = AgentSurvey.objects.get(name=self.name)
826 826 self._agent_survey.mode = self.mode
827 827 self._agent_survey.status = self.status
  828 + self._agent_survey.iteration = self._iter_num
828 829 self._agent_survey.save()
829 830 #self._agent_survey.save(update_fields=["mode", "status"])
830 831  
... ...
src/core/pyros_django/common/models.py
... ... @@ -286,6 +286,7 @@ class AgentSurvey(models.Model):
286 286 #validity_duration = models.DurationField(default=90)
287 287 mode = models.CharField('agent mode', max_length=15, blank=True, choices=MODE_CHOICES)
288 288 status = models.CharField(max_length=15, blank=True, choices=STATUS_CHOICES)
  289 + iteration = models.IntegerField(blank=True, null=True)
289 290  
290 291 class Meta:
291 292 managed = True
... ...