diff options
Diffstat (limited to 'continuedev/src/continuedev/server/main.py')
-rw-r--r-- | continuedev/src/continuedev/server/main.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/continuedev/src/continuedev/server/main.py b/continuedev/src/continuedev/server/main.py index 468bc855..f8dfb009 100644 --- a/continuedev/src/continuedev/server/main.py +++ b/continuedev/src/continuedev/server/main.py @@ -1,5 +1,4 @@ import asyncio -import sys import time import psutil import os @@ -8,13 +7,11 @@ from fastapi.middleware.cors import CORSMiddleware import atexit import uvicorn import argparse -import logging.config from .ide import router as ide_router from .gui import router as gui_router from .session_manager import session_manager -from ..libs.util.paths import getLogFilePath from ..libs.util.logging import logger app = FastAPI() @@ -38,25 +35,6 @@ def health(): return {"status": "ok"} -class Logger(object): - def __init__(self, log_file: str): - self.terminal = sys.stdout - self.log = open(log_file, "a") - - def write(self, message): - self.terminal.write(message) - self.log.write(message) - - def flush(self): - # this flush method is needed for python 3 compatibility. - # this handles the flush command by doing nothing. - # you might want to specify some extra behavior here. - pass - - def isatty(self): - return False - - try: # add cli arg for server port parser = argparse.ArgumentParser() @@ -71,7 +49,6 @@ except Exception as e: def run_server(): config = uvicorn.Config(app, host="127.0.0.1", port=args.port) server = uvicorn.Server(config) - server.run() @@ -87,32 +64,10 @@ def cleanup(): loop.close() -def cpu_usage_report(): - process = psutil.Process(os.getpid()) - # Call cpu_percent once to start measurement, but ignore the result - process.cpu_percent(interval=None) - # Wait for a short period of time - time.sleep(1) - # Call cpu_percent again to get the CPU usage over the interval - cpu_usage = process.cpu_percent(interval=None) - logger.debug(f"CPU usage: {cpu_usage}%") - - atexit.register(cleanup) if __name__ == "__main__": try: - # Uncomment to get CPU usage reports - # import threading - - # def cpu_usage_loop(): - # while True: - # cpu_usage_report() - # time.sleep(2) - - # cpu_thread = threading.Thread(target=cpu_usage_loop) - # cpu_thread.start() - run_server() except Exception as e: logger.debug(f"Error starting Continue server: {e}") |