Commit 4e201d95ffa1105005ec6699fe4084e17a8e39c8

Authored by Etienne Pallier
2 parents 75b13dd6 2ac0a02f
Exists in dev

Merge branch 'dev' of https://gitlab.irap.omp.eu/epallier/pyros into dev

  1 +20-06-2022 (AKo): v0.4.14.0
  2 + - Fixing issues for PYROSW with Windows OS, Adding venv option actions (running pyros in actual venv) if there is one and we're not within docker's pyros container
  3 + - Fixing AgentSST (renaming method properly)
  4 +
1 17-06-2022 (AKo): v0.4.14.0 5 17-06-2022 (AKo): v0.4.14.0
2 - Adding Sequences pickles creation on submit to plannification 6 - Adding Sequences pickles creation on submit to plannification
3 - Renaming commands of AgentSST (Adding prefix 'do') and moving routine work to routine_process_after 7 - Renaming commands of AgentSST (Adding prefix 'do') and moving routine work to routine_process_after
@@ -107,15 +107,32 @@ if DOCKER_OUT_CONTAINER: @@ -107,15 +107,32 @@ if DOCKER_OUT_CONTAINER:
107 # cd docker/ 107 # cd docker/
108 os.chdir('docker') 108 os.chdir('docker')
109 # docker-compose up -d 109 # docker-compose up -d
110 - res = subprocess.run("docker exec -it pyros python3 pyros.py",stdout=subprocess.DEVNULL) 110 + res = subprocess.run("docker exec -it pyros python3 pyros.py",shell=True,stdout=subprocess.DEVNULL)
111 if res.returncode != 0: 111 if res.returncode != 0:
112 run('docker-compose up -d') 112 run('docker-compose up -d')
113 sleep(5) 113 sleep(5)
114 PYROS_CMD = 'docker exec -it pyros ' + PYROS_CMD 114 PYROS_CMD = 'docker exec -it pyros ' + PYROS_CMD
115 115
116 -# PYROS_CMD  
117 -print("\n Executing command :", PYROS_CMD, "\n")  
118 -res = run(PYROS_CMD) 116 +if VENV:
  117 + does_venv_folder_exists = os.path.exists("./venv")
  118 + print(does_venv_folder_exists)
  119 + print(WITH_DOCKER_IS_SET)
  120 + if not does_venv_folder_exists and not WITH_DOCKER_IS_SET:
  121 + print("No virtual environment available.")
  122 + exit(0)
  123 + path_to_bin_folder = ""
  124 + print("\n Executing command in venv :", PYROS_CMD, "\n")
  125 + if os.name == "posix":
  126 + res = run(f"./venv/venv_py3_pyros/"+PYROS_CMD)
  127 + elif os.name == "nt":
  128 + res = run("./venv/venv_py3_pyros/Scripts/python.exe pyros.py "+ args)
  129 + else:
  130 + # java
  131 + pass
  132 +else:
  133 + # PYROS_CMD
  134 + print("\n Executing command :", PYROS_CMD, "\n")
  135 + res = run(PYROS_CMD)
119 136
120 ''' 137 '''
121 #Print the stdout and stderr 138 #Print the stdout and stderr
src/core/pyros_django/agent/AgentSST.py
@@ -159,7 +159,7 @@ class AgentSST(Agent): @@ -159,7 +159,7 @@ class AgentSST(Agent):
159 while self.subprocess_dict[agent].poll() is None: 159 while self.subprocess_dict[agent].poll() is None:
160 time.sleep(0.5) 160 time.sleep(0.5)
161 161
162 - def routine_process_after(self): 162 + def routine_process_after_body(self):
163 now_time = datetime.now(timezone.utc) 163 now_time = datetime.now(timezone.utc)
164 last_running_commands = AgentCmd.get_commands_sent_by_agent("AgentSST").filter(state="CMD_RUNNING") 164 last_running_commands = AgentCmd.get_commands_sent_by_agent("AgentSST").filter(state="CMD_RUNNING")
165 165