Commit 75cb805d89d2516d539618ef26cc36ee92b92b37

Authored by Etienne Pallier
1 parent 15bbe05e
Exists in dev

Par defaut, run in thread

(ajouté commentaires utiles)
Showing 2 changed files with 47 additions and 8 deletions   Show diff stats
src/agent/Agent.py
@@ -176,9 +176,29 @@ class thread_with_exception(threading.Thread): @@ -176,9 +176,29 @@ class thread_with_exception(threading.Thread):
176 176
177 class Agent: 177 class Agent:
178 178
179 - # How to run the agent exec_specific_cmd() method ?  
180 - # - True = inside a Thread  
181 - # - False = inside a Process 179 + """
  180 + How to run this agent exec_specific_cmd() method ?
  181 + - True = inside a Thread (cannot be killed, must be asked to stop, and inadequate for computation)
  182 + - False = inside a Process
  183 + If thread, displays :
  184 + >>>>> Thread: starting execution of command specific1
  185 + >>>>> Thread: PID: 2695, Process Name: MainProcess, Thread Name: Thread-1
  186 + ...
  187 + >>>>> Thread: starting execution of command specific2
  188 + >>>>> Thread: PID: 2695, Process Name: MainProcess, Thread Name: Thread-2
  189 + ...
  190 + >>>>> Thread: starting execution of command specific3
  191 + >>>>> Thread: PID: 2695, Process Name: MainProcess, Thread Name: Thread-3
  192 + If process, displays :
  193 + >>>>> Thread: starting execution of command specific1
  194 + >>>>> Thread: PID: 2687, Process Name: Process-1, Thread Name: MainThread
  195 + ...
  196 + >>>>> Thread: starting execution of command specific2
  197 + >>>>> Thread: PID: 2689, Process Name: Process-2, Thread Name: MainThread
  198 + ...
  199 + >>>>> Thread: starting execution of command specific3
  200 + >>>>> Thread: PID: 2690, Process Name: Process-3, Thread Name: MainThread
  201 + """
182 RUN_IN_THREAD = True 202 RUN_IN_THREAD = True
183 203
184 # FOR TEST ONLY 204 # FOR TEST ONLY
src/agent/AgentX.py
@@ -16,11 +16,30 @@ log = L.setupLogger("AgentXTaskLogger", "AgentX") @@ -16,11 +16,30 @@ log = L.setupLogger("AgentXTaskLogger", "AgentX")
16 16
17 class AgentX(Agent): 17 class AgentX(Agent):
18 18
19 -  
20 - # How to run this agent exec_specific_cmd() method ?  
21 - # - True = inside a Thread  
22 - # - False = inside a Process  
23 - RUN_IN_THREAD = False 19 + """
  20 + How to run this agent exec_specific_cmd() method ?
  21 + - True = inside a Thread (cannot be killed, must be asked to stop, and inadequate for computation)
  22 + - False = inside a Process
  23 + If thread, displays :
  24 + >>>>> Thread: starting execution of command specific1
  25 + >>>>> Thread: PID: 2695, Process Name: MainProcess, Thread Name: Thread-1
  26 + ...
  27 + >>>>> Thread: starting execution of command specific2
  28 + >>>>> Thread: PID: 2695, Process Name: MainProcess, Thread Name: Thread-2
  29 + ...
  30 + >>>>> Thread: starting execution of command specific3
  31 + >>>>> Thread: PID: 2695, Process Name: MainProcess, Thread Name: Thread-3
  32 + If process, displays :
  33 + >>>>> Thread: starting execution of command specific1
  34 + >>>>> Thread: PID: 2687, Process Name: Process-1, Thread Name: MainThread
  35 + ...
  36 + >>>>> Thread: starting execution of command specific2
  37 + >>>>> Thread: PID: 2689, Process Name: Process-2, Thread Name: MainThread
  38 + ...
  39 + >>>>> Thread: starting execution of command specific3
  40 + >>>>> Thread: PID: 2690, Process Name: Process-3, Thread Name: MainThread
  41 + """
  42 + RUN_IN_THREAD = True
24 43
25 44
26 """ 45 """