mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 18:02:41 +02:00
Call uvicorn via python rather than subprocess
This commit is contained in:
parent
2383326af8
commit
fa9e79d72c
2 changed files with 7 additions and 10 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()
|
||||
|
|
|
@ -19,7 +19,7 @@ myst_enable_extensions = ["colon_fence"]
|
|||
|
||||
templates_path = ["_templates"]
|
||||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
||||
mermaid_params = ['--theme', 'forest']
|
||||
mermaid_params = ["--theme", "forest"]
|
||||
|
||||
html_sidebars = {
|
||||
"**": [
|
||||
|
|
Loading…
Reference in a new issue