Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change log object #553

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ isort:
# First deal with the core folder, and then gradually increase the scope of detection,
# and eventually realize the detection of the complete project.
mypy:
$(PIPRUN) python -m mypy rdagent/core # --exclude rdagent/scripts,git_ignore_folder
$(PIPRUN) python -m mypy rdagent/core --exclude rdagent/log/ui # --exclude rdagent/scripts,git_ignore_folder

# Check lint with ruff.
# First deal with the core folder, and then gradually increase the scope of detection,
3 changes: 3 additions & 0 deletions rdagent/app/cli.py
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
import fire

from rdagent.app.data_mining.model import main as med_model
from rdagent.app.data_science.loop import main as ds_loop
from rdagent.app.general_model.general_model import (
extract_models_and_implement as general_model,
)
@@ -56,5 +57,7 @@ def app():
"health_check": health_check,
"collect_info": collect_info,
"kaggle": kaggle_main,
"start_flask_server": subprocess.run(["python", "rdagent/log/server/app.py"]),
"ds_loop": ds_loop,
}
)
10 changes: 10 additions & 0 deletions rdagent/log/logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
import pickle
import requests
import sys
from contextlib import contextmanager
from datetime import datetime, timezone
@@ -21,6 +22,7 @@
from rdagent.core.conf import RD_AGENT_SETTINGS
from rdagent.core.utils import SingletonBaseClass

from .ui.utils import format_pkl
from .storage import FileStorage
from .utils import LogColors, get_caller_info

@@ -131,6 +133,14 @@ def log_object(self, obj: object, *, tag: str = "") -> None:
return

logp = self.storage.log(obj, name=tag, save_type="pkl")

try:
flask_url = "http://127.0.0.1:19899"
response = requests.get(flask_url, timeout=1)
if response.status_code == 200:
format_pkl(obj=obj, tag=tag, log_trace_path=self.log_trace_path)
except requests.ConnectionError:
pass

file_handler_id = logger.add(
self.log_trace_path / tag.replace(".", "/") / "common_logs.log", format=self.file_format
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.