Commit 15afe6e1eec77fd3643413bfed53b14b602f4497

Authored by Etienne Pallier
1 parent 9e7aba88
Exists in dev

bugfix Agent.run(N) pour exécuter N iterations

Showing 3 changed files with 11 additions and 4 deletions   Show diff stats
README.md
... ... @@ -71,7 +71,7 @@ Date: 22/03/2019
71 71  
72 72 Author: E. Pallier
73 73  
74   -VERSION: 0.20.28
  74 +VERSION: 0.20.29
75 75  
76 76 Comment: mode "test" (-t) géré (= mode simulateur)
77 77  
... ... @@ -80,6 +80,7 @@ Comment: mode "test" (-t) géré (= mode simulateur)
80 80 - attendre 1 à 2mn jusqu'à obtenir les 2 résultats suivants:
81 81 (AgentA): Finished testing => result is ok
82 82 (AgentB): Finished testing => result is ok
  83 +
83 84 - Mode opératoire pour lancer un agent (en mode normal, hors test) :
84 85 - pour lancer agentA seulement : ./pyros.py start agentA [-c configfile]
85 86 - pour lancer plusieurs agents : ./pyros.py start agentA,agentB,... [-c configfile]
... ... @@ -88,6 +89,7 @@ Comment: mode "test" (-t) géré (= mode simulateur)
88 89  
89 90 - Autres remarques:
90 91 - pyros.py peut lancer plusieurs agents (A et B) en même temps
  92 + - run(N) : run only N iterations
91 93 - send_command() implemented
92 94 - EVAL is now a generic command
93 95 - mode DEBUG (2 niveaux pour print)
... ...
pyros.py
... ... @@ -235,9 +235,12 @@ def shell():
235 235 print(" >>> from agent.AgentA import AgentA")
236 236 print(" >>> agent=AgentA('agent_toto')")
237 237 print(" >>> agent")
  238 + print(" >>> agent.run(2) (=> will run 2 iterations)")
238 239 print(" >>> cmd = agent.send_command('AgentB','eval 2+2')")
239 240 print(" >>> cmd")
240 241 print(" >>> cmd1.get_updated_result()")
  242 + print(" >>> ...")
  243 + print(" - See documentation, section 'Play with a pyros agent' inside the chapter 'Running pyros' for more details")
241 244 print()
242 245 print("NB2: If you want to play with the pyros objects, type:")
243 246 print(" >>> from common.models import *")
... ... @@ -246,8 +249,8 @@ def shell():
246 249 print(" - For example, to create an AgentSurvey object, type:")
247 250 print(" >>> agent_survey = AgentSurvey()")
248 251 print(" >>> agent_survey")
249   - print()
250   - print("See documentation, section 'Play with the pyros objects' inside the chapter 'Running pyros' for more details")
  252 + print(" >>> ...")
  253 + print(" - See documentation, section 'Play with the pyros objects' inside the chapter 'Running pyros' for more details")
251 254 print()
252 255 print("Type 'exit()' to quit")
253 256 print()
... ...
src/agent/Agent.py
... ... @@ -333,7 +333,8 @@ class Agent:
333 333 _computer_description = ''
334 334 _path_data = '../../config'
335 335  
336   - _iter_num = 1
  336 + _iter_num = None
  337 +
337 338  
338 339 def __init__(self, name:str="Agent", config_filename:str=None, RUN_IN_THREAD=True):
339 340 self.name = name
... ... @@ -451,6 +452,7 @@ class Agent:
451 452 return -1
452 453 '''
453 454  
  455 + self._iter_num = 1
454 456 # Main loop
455 457 while True:
456 458  
... ...