Skip to content

Commit 89f4af9

Browse files
SunsetWolfyou-n-gHytnTPLin22xisen-w
authored
feat: add collect info (#233)
* add collect info * fix isort error * optimize code * fix black error * Update rdagent/app/cli.py * Modify the code according to the comments * fix isort error * add docker info * docs: update contributors (#230) * fix: package dependency. (#234) * fix package * fix lint * docs: Update development.rst (#235) * feat: add cross validation for kaggle scenario (#236) * update cross validation for kaggle scenario * CI Issues * delete useless file * CI issues * docs: Update README.md (#245) * docs: refine the README (#244) * init a scenario for kaggle feature engineering * update the readme * Delete rdagent/app/kaggle_feature/conf.py * update some pictures * Delete rdagent/app/kaggle_feature/model.py * change a photo * add pics to docs * update the readme * update the README * for a try * for another try * change the style of the pictures in readme * fix a small bug * update the readme and the docs * update the docs * fix a typo * change a website url * change some styles * fix a typo * change the size of the logo * change two urls * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: Linlang <[email protected]> * move the component to other files * last container * optimize rdagent info * format with isort * format with black * format_with_black * fix pip error * format with isort * change requirements * fix pip error * fix_pip_error * fix pip error * format with black * fix pip error --------- Co-authored-by: you-n-g <[email protected]> Co-authored-by: Haotian Chen <[email protected]> Co-authored-by: Haoran Pan <[email protected]> Co-authored-by: Way2Learn <[email protected]> Co-authored-by: WinstonLiyt <[email protected]> Co-authored-by: Young <[email protected]>
1 parent 2afd899 commit 89f4af9

File tree

5 files changed

+108
-13
lines changed

5 files changed

+108
-13
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,24 @@ Steps to reproduce the behavior:
2727
<!-- A screenshot of the error message or anything shouldn't appear-->
2828

2929
## Environment
30-
<!-- TODO: We may provide a more automatic way to get the information -->
31-
- RD-Agent version:
30+
31+
**Note**: Users can run `rdagent collect_info` to get system information and paste it directly here.
32+
33+
- Name of current operating system:
34+
- Processor architecture:
35+
- System, version, and hardware information:
36+
- Version number of the system:
3237
- Python version:
33-
- OS: Linux
34-
- Commit number (optional, please provide it if you are using the dev version):
38+
- Container ID:
39+
- Container Name:
40+
- Container Status:
41+
- Image ID used by the container:
42+
- Image tag used by the container:
43+
- Container port mapping:
44+
- Container Label:
45+
- Startup Commands:
46+
- RD-Agent version:
47+
- Package version:
3548

3649
## Additional Notes
3750

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
[![Lint PR Title](https://github.com/microsoft/RD-Agent/actions/workflows/pr.yml/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/pr.yml)
1111
[![Readthedocs Preview](https://github.com/microsoft/RD-Agent/actions/workflows/readthedocs-preview.yml/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/readthedocs-preview.yml)
1212
[![Release.yml](https://github.com/microsoft/RD-Agent/actions/workflows/release.yml/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/release.yml)
13+
[![Platform](https://img.shields.io/badge/platform-Linux-blue)](https://pypi.org/project/rdagent/#files)
1314
[![PyPI](https://img.shields.io/pypi/v/rdagent)](https://pypi.org/project/rdagent/)
1415
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rdagent)](https://pypi.org/project/rdagent/)
1516
[![Release](https://img.shields.io/github/v/release/microsoft/RD-Agent)](https://github.com/microsoft/RD-Agent/releases)

rdagent/app/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from rdagent.app.qlib_rd_loop.factor import main as fin_factor
1919
from rdagent.app.qlib_rd_loop.factor_from_report import main as fin_factor_report
2020
from rdagent.app.qlib_rd_loop.model import main as fin_model
21+
from rdagent.app.utils.info import collect_info
2122

2223
load_dotenv()
2324

@@ -46,5 +47,6 @@ def app():
4647
"med_model": med_model,
4748
"general_model": general_model,
4849
"ui": ui,
50+
"collect_info": collect_info,
4951
}
5052
)

rdagent/app/utils/info.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import importlib.metadata
2+
import platform
3+
import sys
4+
from pathlib import Path
5+
6+
import docker
7+
import requests
8+
from setuptools_scm import get_version
9+
10+
from rdagent.log import rdagent_logger as logger
11+
12+
13+
def sys_info():
14+
"""collect system related info"""
15+
method_list = [
16+
["Name of current operating system: ", "system"],
17+
["Processor architecture: ", "machine"],
18+
["System, version, and hardware information: ", "platform"],
19+
["Version number of the system: ", "version"],
20+
]
21+
for method in method_list:
22+
logger.info(f"{method[0]}{getattr(platform, method[1])()}")
23+
return None
24+
25+
26+
def python_info():
27+
"""collect Python related info"""
28+
python_version = sys.version.replace("\n", " ")
29+
logger.info(f"Python version: {python_version}")
30+
return None
31+
32+
33+
def docker_info():
34+
client = docker.from_env()
35+
containers = client.containers.list(all=True)
36+
if containers:
37+
containers.sort(key=lambda c: c.attrs["Created"])
38+
last_container = containers[-1]
39+
logger.info(f"Container ID: {last_container.id}")
40+
logger.info(f"Container Name: {last_container.name}")
41+
logger.info(f"Container Status: {last_container.status}")
42+
logger.info(f"Image ID used by the container: {last_container.image.id}")
43+
logger.info(f"Image tag used by the container: {last_container.image.tags}")
44+
logger.info(f"Container port mapping: {last_container.ports}")
45+
logger.info(f"Container Label: {last_container.labels}")
46+
logger.info(f"Startup Commands: {' '.join(client.containers.get(last_container.id).attrs['Config']['Cmd'])}")
47+
else:
48+
logger.info(f"No run containers.")
49+
50+
51+
def rdagent_info():
52+
"""collect rdagent related info"""
53+
current_version = importlib.metadata.version("rdagent")
54+
logger.info(f"RD-Agent version: {current_version}")
55+
api_url = f"https://api.github.com/repos/microsoft/RD-Agent/contents/requirements.txt?ref=main"
56+
response = requests.get(api_url)
57+
if response.status_code == 200:
58+
files = response.json()
59+
file_url = files["download_url"]
60+
file_response = requests.get(file_url)
61+
if file_response.status_code == 200:
62+
all_file_contents = file_response.text.split("\n")
63+
else:
64+
logger.warning(f"Failed to retrieve {files['name']}, status code: {file_response.status_code}")
65+
else:
66+
logger.warning(f"Failed to retrieve files in folder, status code: {response.status_code}")
67+
package_list = [
68+
item.split("#")[0].strip() for item in all_file_contents if item.strip() and not item.startswith("#")
69+
]
70+
package_version_list = []
71+
for package in package_list:
72+
if package == "typer[all]":
73+
package = "typer"
74+
version = importlib.metadata.version(package)
75+
package_version_list.append(f"{package}=={version}")
76+
logger.info(f"Package version: {package_version_list}")
77+
return None
78+
79+
80+
def collect_info():
81+
"""Prints information about the system and the installed packages."""
82+
sys_info()
83+
python_info()
84+
docker_info()
85+
rdagent_info()
86+
return None

requirements.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tiktoken
2828
pymupdf # Extract shotsreens from pdf
2929

3030
# azure identity related
31-
azure.identity
31+
azure-identity
3232

3333
# PDF related
3434
pypdf
@@ -39,17 +39,9 @@ azure-ai-formrecognizer
3939
# I think it is for running insteading of implementing. The dependency should be in
4040
statsmodels
4141

42-
# PDF related
43-
pypdf
44-
azure-core
45-
azure-ai-formrecognizer
46-
4742
# factor implementations
4843
tables
4944

50-
# azure identity related
51-
azure.identity
52-
5345
# CI Fix Tool
5446
tree-sitter-python
5547
tree-sitter
@@ -72,6 +64,7 @@ selenium
7264
kaggle
7365

7466
seaborn
67+
setuptools-scm
7568

7669
# This is a temporary package installed to pass the test_import test
7770
xgboost

0 commit comments

Comments
 (0)