mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 18:02:41 +02:00
Merge branch 'almet/fix-serverstart' into 'main'
Call uvicorn via python rather than subprocess See merge request framasoft/framaspace/argos!8
This commit is contained in:
commit
b21399792e
1 changed files with 6 additions and 9 deletions
|
@ -1,7 +1,8 @@
|
|||
import asyncio
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
import click
|
||||
import uvicorn
|
||||
|
||||
from argos import logging
|
||||
from argos.agent import ArgosAgent
|
||||
|
@ -51,16 +52,12 @@ def agent(server, auth, max_tasks, wait_time, log_level):
|
|||
@server.command()
|
||||
@click.option("--host", default="127.0.0.1", help="Host to bind")
|
||||
@click.option("--port", default=8000, type=int, help="Port to bind")
|
||||
@click.option("--config", default="config.yaml", help="Path the the configuration file")
|
||||
@click.option("--reload", is_flag=True, help="Enable hot reloading")
|
||||
@click.option("--log-config", help="Path to the logging configuration file")
|
||||
def start(host, port, reload, log_config):
|
||||
def start(host, port, config, reload):
|
||||
"""Starts the server."""
|
||||
command = ["uvicorn", "argos.server:app", "--host", host, "--port", str(port)]
|
||||
if reload:
|
||||
command.append("--reload")
|
||||
if log_config:
|
||||
command.extend(["--log-config", log_config])
|
||||
subprocess.run(command)
|
||||
os.environ["ARGOS_YAML_FILE"] = config
|
||||
uvicorn.run("argos.server:app", host=host, port=port, reload=reload)
|
||||
|
||||
|
||||
@server.command()
|
||||
|
|
Loading…
Reference in a new issue