Compare commits
No commits in common. "26a54848f11e043f598460b1475b96eeefc0d43e" and "5f06d7e04c036e289b6c71a7005fd37aaca5b178" have entirely different histories.
26a54848f1
...
5f06d7e04c
@ -14,5 +14,5 @@ RUN echo 'root:root' | chpasswd
|
||||
|
||||
COPY ./terminal /opt/bootstrap
|
||||
COPY ./terminal /opt/snek
|
||||
RUN cp -r /root /opt/bootstrap/root
|
||||
RUN cp -r ./root /opt/bootrap/root
|
||||
COPY ./terminal/entry /usr/local/bin/entry
|
||||
|
||||
@ -3,7 +3,6 @@ import logging
|
||||
import pathlib
|
||||
import ssl
|
||||
import uuid
|
||||
import signal
|
||||
from datetime import datetime
|
||||
|
||||
from snek import snode
|
||||
@ -211,10 +210,6 @@ class Application(BaseApplication):
|
||||
# app.loop = asyncio.get_running_loop()
|
||||
app.executor = ThreadPoolExecutor(max_workers=200)
|
||||
app.loop.set_default_executor(self.executor)
|
||||
for sig in (signal.SIGINT, signal.SIGTERM):
|
||||
app.loop.add_signal_handler(
|
||||
sig, lambda: asyncio.create_task(self.services.container.shutdown())
|
||||
)
|
||||
|
||||
async def create_task(self, task):
|
||||
await self.tasks.put(task)
|
||||
|
||||
@ -12,9 +12,6 @@ class ContainerService(BaseService):
|
||||
self.compose = ComposeFileManager(self.compose_path,self.container_event_handler)
|
||||
self.event_listeners = {}
|
||||
|
||||
async def shutdown(self):
|
||||
return await self.compose.shutdown()
|
||||
|
||||
async def add_event_listener(self, name, event,event_handler):
|
||||
if not name in self.event_listeners:
|
||||
self.event_listeners[name] = {}
|
||||
|
||||
@ -17,17 +17,6 @@ class ComposeFileManager:
|
||||
self.running_instances = {}
|
||||
self.event_handler = event_handler
|
||||
|
||||
async def shutdown(self):
|
||||
print("Stopping all sessions")
|
||||
for name in self.list_instances():
|
||||
proc = self.running_instances.get(name)
|
||||
if not proc:
|
||||
continue
|
||||
if proc['proc'].returncode == None:
|
||||
print("Stopping",name)
|
||||
await proc['proc'].stop()
|
||||
print("Stopped",name,"gracefully")
|
||||
|
||||
def _load(self):
|
||||
try:
|
||||
with open(self.compose_path) as f:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user