fixed non ending sending of the notifications from the backend to the frontend

fixed non starting plotting after delete
This commit is contained in:
Zlatko
2021-04-01 22:50:40 -07:00
committed by Gene Hoffman
parent 05b4659633
commit 9106b91cc4
+12 -3
View File
@@ -66,6 +66,7 @@ class PlotState(str, Enum):
SUBMITTED = "SUBMITTED"
RUNNING = "RUNNING"
ERROR = "ERROR"
DELETED = "DELETED"
FINISHED = "FINISHED"
@@ -355,13 +356,16 @@ class WebSocketServer:
while True:
new = await loop.run_in_executor(io_pool_exc, fp.readline)
if config["state"] is not PlotState.RUNNING:
return
config["log"] = new if config["log"] is None else config["log"] + new
self.state_changed(service_plotter, "log_changed")
if new:
for word in words:
if word in new:
yield (word, new)
return
else:
time.sleep(0.5)
@@ -371,8 +375,7 @@ class WebSocketServer:
if config is None:
raise Exception(f"Plot queue config with ID {id} is not defined")
async for hit_word, hit_sentence in self._watch_file_changes(id, loop):
break
await self._watch_file_changes(id, loop)
def _build_plotting_command_args(self, request: Any, ignoreCount: bool) -> List[str]:
service_name = request["service"]
@@ -455,6 +458,9 @@ class WebSocketServer:
delay = config["delay"]
await asyncio.sleep(delay)
if config["state"] is PlotState.DELETED:
return
service_name = config["service_name"]
command_args = config["command_args"]
self.log.debug(f"command_args before launch_plotter are {command_args}")
@@ -549,6 +555,9 @@ class WebSocketServer:
process = config["process"]
queue = config["queue"]
# mark plot config as deleted for already running asyncio functions
config["state"] = PlotState.DELETED
try:
run_next = False
if process is not None and state == PlotState.RUNNING: