mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-28 16:07:46 +00:00
c8f1c5364a
* change_log_object * lint code * delete comments * change_log_object * change_log_object * fix import test error * update code * update code * fix bugs * skip mypy error * skip mypy error * skip mypy error * Start the flask server before running the demo. * achieve front and back interaction * fix github-advanced-security comments * fix github-advanced-security comments * tmp ignore * fix CI * move some logic * change format * adjust logic * log2json changes * tmp * fix * fix bug * refine log2json between 5 scenarios * fix * refine codes * fix logic * use localhost * add loop & all_duration param for old scenario startup * merge control logic * add README for server ui api * update README * reuse code in logger * add loop_n and all_duration param * fix upload * ui server now use port in setting * fix port setting * fix port setting * fix mypy check * refine logger and log storage * fix ruff error * fix CI * refine logger, loop, storage * bind one FileStorage with one logger * not truncate log storage * refine LoopBase.load(), use `checkout` instead of `output_path` and `do_truncate` * clear session folder when loading loop to run * move component info init step to ExpGen Class * Update rdagent/utils/workflow.py * move truncate_session function to LoopBase class * add checkout param for other scenarios * fix bug * move WebStorage to UI * change web_storage name * add randomname to requirements * add typer * fix requirements --------- Co-authored-by: WinstonLiyte <1957922024@qq.com> Co-authored-by: Bowen Xian <xianbowen@outlook.com> Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
71 lines
2.1 KiB
Python
71 lines
2.1 KiB
Python
"""
|
|
CLI entrance for all rdagent application.
|
|
|
|
This will
|
|
- make rdagent a nice entry and
|
|
- autoamtically load dotenv
|
|
"""
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv(".env")
|
|
# 1) Make sure it is at the beginning of the script so that it will load dotenv before initializing BaseSettings.
|
|
# 2) The ".env" argument is necessary to make sure it loads `.env` from the current directory.
|
|
|
|
import subprocess
|
|
from importlib.resources import path as rpath
|
|
|
|
import fire
|
|
|
|
from rdagent.app.data_mining.model import main as med_model
|
|
from rdagent.app.data_science.loop import main as kaggle
|
|
from rdagent.app.general_model.general_model import (
|
|
extract_models_and_implement as general_model,
|
|
)
|
|
from rdagent.app.qlib_rd_loop.factor import main as fin_factor
|
|
from rdagent.app.qlib_rd_loop.factor_from_report import main as fin_factor_report
|
|
from rdagent.app.qlib_rd_loop.model import main as fin_model
|
|
from rdagent.app.qlib_rd_loop.quant import main as fin_quant
|
|
from rdagent.app.utils.health_check import health_check
|
|
from rdagent.app.utils.info import collect_info
|
|
|
|
|
|
def ui(port=19899, log_dir="", debug=False):
|
|
"""
|
|
start web app to show the log traces.
|
|
"""
|
|
with rpath("rdagent.log.ui", "app.py") as app_path:
|
|
cmds = ["streamlit", "run", app_path, f"--server.port={port}"]
|
|
if log_dir or debug:
|
|
cmds.append("--")
|
|
if log_dir:
|
|
cmds.append(f"--log_dir={log_dir}")
|
|
if debug:
|
|
cmds.append("--debug")
|
|
subprocess.run(cmds)
|
|
|
|
|
|
def server_ui(port=19899):
|
|
"""
|
|
start web app to show the log traces in real time
|
|
"""
|
|
subprocess.run(["python", "rdagent/log/server/app.py", f"--port={port}"])
|
|
|
|
|
|
def app():
|
|
fire.Fire(
|
|
{
|
|
"fin_factor": fin_factor,
|
|
"fin_factor_report": fin_factor_report,
|
|
"fin_model": fin_model,
|
|
"fin_quant": fin_quant,
|
|
"med_model": med_model,
|
|
"general_model": general_model,
|
|
"ui": ui,
|
|
"health_check": health_check,
|
|
"collect_info": collect_info,
|
|
"kaggle": kaggle,
|
|
"server_ui": server_ui,
|
|
}
|
|
)
|