Files
NexQuant/rdagent/log/ui/web.py
T
XianBW eee2b3c56a adjust logging system (#51)
* remove ruff comment in log.py

* change log framework and fix llm_utils.py's logs

* Some thoughts for logging

* fix SingletonMeta's definition, maintain an instance dict for each class that inherits it

* adjust log codes directory, add some tag for factor implementation logging

* Update rdagent/core/conf.py

* fix factor task app & log

* fix log import

* Streamlet framework

* fix log tag to path logic

* Add todos

* Add example in docstring

* add log tag for llm_utils.py

* Capture lost content

---------

Co-authored-by: Young <afe.young@gmail.com>
Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
2024-07-16 20:35:42 +08:00

93 lines
1.9 KiB
Python

from rdagent.log.base import View, Storage
from pathlib import Path
class ProcessView(View):
def __init__(self, trace_path: Path):
# Save logs to your desired data structure
# ...
pass
def display(s: Storage, watch: bool = False):
pass
class WebView(View):
r"""
We have tree structure for sequence
session
| \
... defined by user ...
| \
info1 -> info2 -> ... -> info3 -> ... overtime.
<message dispature>
| | - dispatch according to uri(e.g. `a.b.c. ...`)
Frontend is composed of windows.
Each window can individually display the message flow.
Some design principles:
session1.module(e.g. implement).
`s.log(a.b.1.c) s.log(a.b.2.c)` should not handed over to users.
An display example:
W1 write factor
W2 evaluate factor
W3 backtest
W123
R
RX
RXX
RX
W4
trace r1 r2 r3 r4
What to do next?
1. Data structure
2. Map path like `a.b.c` to frontend components
3. Display logic
"""
def __init__(self, trace_path: Path):
pass
# Save logs to your desired data structure
# ...
def display(s: Storage, watch: bool = False):
ui = STLUI()
for msg in s.iter_msg(): # iterate overtime
# NOTE: iter_msg will correctly seperate the information.
# TODO: msg may support streaming mode.
ui.dispatch(msg)
pass
# TODO: Implement the following classes
class STLWindow:
...
def consume_msg(self, msg):
... # update it's view
class STLUI:
wd_l: list[STLWindow]
def __init__(self):
self.build_ui()
def build_ui(self):
# control the dispaly of windows
...
def dispatch(self, msg):
# map the message to a specific window
...