diff --git a/CHANGELOG b/CHANGELOG index e7af075..30b46ab 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ + +07-11-2022 (EP): v0.6.7.3 + - Renamed Agent Status names + 07-11-2022 (AKo): v0.6.7.2 - Improve agents commands view (add status filter) - Add port configuration for phpmyadmin in docker-compose.yml diff --git a/VERSION b/VERSION index e5cdb87..a3c2491 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.7.2 \ No newline at end of file +0.6.7.3 \ No newline at end of file diff --git a/src/core/pyros_django/agent/Agent.py b/src/core/pyros_django/agent/Agent.py index 540495c..5960ed3 100755 --- a/src/core/pyros_django/agent/Agent.py +++ b/src/core/pyros_django/agent/Agent.py @@ -1072,7 +1072,7 @@ class Agent: def __main_loop(self, nb_iter:int=None, FOR_REAL:bool=True): - self.__set_and_log_status(self.AGT_STATUS.IN_MAIN_LOOP) + self.__set_and_log_status(self.AGT_STATUS.IN_MAIN_LOOP_START) self.__main_loop_start(nb_iter) #if not self.DO_MAIN_LOOP: return @@ -1194,7 +1194,8 @@ class Agent: log.info('-'*6 + "CMD finished WITH EXCEPTION ") self.__process_exception(self.CCE) self.__CCE = None - if self.is_in_test_mode(): + print("my name is", self.__CC.sender, self.__class__.__name__) + if self.is_in_test_mode() and self.__CC.sender==self.__class__.__name__ : self.__TEST_check_current_cmd_res_and_status() #self.CC = None @@ -1397,7 +1398,7 @@ class Agent: def __start_cmd(self, cmd:AgentCmd)->None: ''' Processing the next pending command (self.__CC) ''' #cmd = self.__CC - self.__set_and_log_status(self.AGT_STATUS.IN_GET_NEXT_CMD) + self.__set_and_log_status(self.AGT_STATUS.IN_MAIN_LOOP_GET_NEXT_CMD) #print() #print() @@ -1535,7 +1536,7 @@ class Agent: print() log.info("*"*10+ " ROUTINE BEFORE (START) "+ "*"*10+ '\n') - self.__set_and_log_status(self.AGT_STATUS.IN_ROUTINE_BEF) + self.__set_and_log_status(self.AGT_STATUS.IN_MAIN_LOOP_ROUTINE_BEFORE) self._routine_process_before_body() print() @@ -1562,7 +1563,7 @@ class Agent: print() log.info("*"*10+ " ROUTINE AFTER (START) "+ "*"*10+ '\n') - self.__set_and_log_status(self.AGT_STATUS.IN_ROUTINE_AFT) + self.__set_and_log_status(self.AGT_STATUS.IN_MAIN_LOOP_ROUTINE_AFTER) self._routine_process_after_body() print() @@ -2026,7 +2027,7 @@ class Agent: OLD version was : Return still VALID (not expired) command """ - self.__set_and_log_status(self.AGT_STATUS.IN_GET_NEXT_CMD) + self.__set_and_log_status(self.AGT_STATUS.IN_MAIN_LOOP_GET_NEXT_CMD) log.info("Looking for a new received command to process (sent by another agent):") # 1) Get all pending commands for me (return if None) diff --git a/src/core/pyros_django/agent/doc/Agent_activity_diag_SIMPLE_async.pu b/src/core/pyros_django/agent/doc/Agent_activity_diag_SIMPLE_async.pu index 63da990..9f54ae1 100644 --- a/src/core/pyros_django/agent/doc/Agent_activity_diag_SIMPLE_async.pu +++ b/src/core/pyros_django/agent/doc/Agent_activity_diag_SIMPLE_async.pu @@ -24,6 +24,7 @@ ' FontName Impact ' } + title __**Agent activity diagram (simplified)**__ Agent async v2 (run loop) - Version 28-10-2022 (E. Pallier) @@ -34,8 +35,10 @@ end title '|Agent| start +skinparam ConditionEndStyle hline skinparam LegendBackgroundColor yellow skinparam LegendBorderColor red + legend top right Every important step is logged in database, with these information : @@ -71,14 +74,13 @@ repeat 'end note '#green:routine_process_before(); - :**routine_process_before()**; + #lightblue:**routine_process_before()**; note right Only if NOT in IDLE mode Only if previous routine_process_after() finished (can be run in parallel) end note - :**CC = start_next_received_cmd_if_exists()**; - :cmd = **start_next_received_cmd_if_possible_and_exists()**; + #lightblue:cmd = **start_next_received_cmd_if_possible_and_exists()**; note right ONLY possible if : - no current command CC @@ -86,19 +88,19 @@ repeat - current command CC finished (can be run in parallel) OR - PRIORITY cmd received - --> Then start and return next received cmd (only if exists) - --> Otherwise, return None - This may throw Exception (CmdInvalid, CmdUnimplemented, CmdExecError, CmdExecTimeout...) : stored in CCE + + Then start and return next received cmd (only if exists, otherwise return None) + This may throw **Exception** (CmdInvalid, CmdUnimplemented, CmdExecError, CmdExecTimeout...) => stored in **CCE** Command received can be of 3 types : - - Agent General cmd :s always executed (sequential exec) + - Agent General cmd : always executed (sequential exec) - Agent Specific cmd : only executed if in ATTENTIVE mode - Other cmd (device) : only executed if in ATTENTIVE mode end note - if (cmd) then + if (cmd ?) then (yes) :CC_prev = CC CC = cmd; - else ( no) + else (no) endif if (CC.is_running() and CC.is_exec_timeout()) then (yes) @@ -115,7 +117,7 @@ repeat else ( no) endif note right - If current cmd is finished => display cmd state and then process exception if existss + If current cmd is finished => display cmd state and then process exception if exists end note 'if (DO_RESTART or DO_STOP ?) then (yes) @@ -125,7 +127,7 @@ repeat ' endif 'else (no) '#green:process_routine_after(); - :**routine_process_after()**; + #lightblue:**routine_process_after()**; note right (not executed if cmd was STOP or RESTART) Only if NOT in IDLE mode diff --git a/src/core/pyros_django/common/models.py b/src/core/pyros_django/common/models.py index 2a21f1b..f6efdd6 100644 --- a/src/core/pyros_django/common/models.py +++ b/src/core/pyros_django/common/models.py @@ -342,12 +342,12 @@ class AgentSurvey(models.Model): STATUS_CHOICES = Choices( 'LAUNCHED', 'INITIALIZING', - 'IN_MAIN_LOOP', - 'IN_ROUTINE_BEF', - 'IN_GET_NEXT_CMD', - 'IN_ROUTINE_AFT', - 'EXITING', - 'RESTARTING', + 'IN_MAIN_LOOP_START', + 'IN_MAIN_LOOP_ROUTINE_BEFORE', + 'IN_MAIN_LOOP_GET_NEXT_CMD', + 'IN_MAIN_LOOP_ROUTINE_AFTER', + 'EXITING', # STOP or HARD restart + 'RESTARTING', # SOFT restart ) name = models.CharField(max_length=50, unique=True) @@ -362,7 +362,7 @@ class AgentSurvey(models.Model): #default = MODE_CHOICES.ATTENTIVE ) status = models.CharField( - max_length=15, blank=True, choices=STATUS_CHOICES) + max_length=30, blank=True, choices=STATUS_CHOICES) iteration = models.IntegerField(blank=True, null=True) nb_restart_max = models.IntegerField(blank=True,null=True,default=3) current_nb_restart = models.IntegerField(blank=True,null=True,default=0) -- libgit2 0.21.2