Skip to content

Commit

Permalink
feat: add collect info (#233)
Browse files Browse the repository at this point in the history
* 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 <Lv.Linlang@hotmail.com>

* 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 <you-n-g@users.noreply.github.com>
Co-authored-by: Haotian Chen <113661982+Hytn@users.noreply.github.com>
Co-authored-by: Haoran Pan <167847254+TPLin22@users.noreply.github.com>
Co-authored-by: Way2Learn <118058822+Xisen-Wang@users.noreply.github.com>
Co-authored-by: WinstonLiyt <104308117+WinstonLiyt@users.noreply.github.com>
Co-authored-by: Young <afe.young@gmail.com>
  • Loading branch information
7 people authored Sep 7, 2024
1 parent 2afd899 commit 89f4af9
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 13 deletions.
21 changes: 17 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,24 @@ Steps to reproduce the behavior:
<!-- A screenshot of the error message or anything shouldn't appear-->

## Environment
<!-- TODO: We may provide a more automatic way to get the information -->
- RD-Agent version:

**Note**: Users can run `rdagent collect_info` to get system information and paste it directly here.

- Name of current operating system:
- Processor architecture:
- System, version, and hardware information:
- Version number of the system:
- Python version:
- OS: Linux
- Commit number (optional, please provide it if you are using the dev version):
- Container ID:
- Container Name:
- Container Status:
- Image ID used by the container:
- Image tag used by the container:
- Container port mapping:
- Container Label:
- Startup Commands:
- RD-Agent version:
- Package version:

## Additional Notes

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[![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)
[![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)
[![Release.yml](https://github.com/microsoft/RD-Agent/actions/workflows/release.yml/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/release.yml)
[![Platform](https://img.shields.io/badge/platform-Linux-blue)](https://pypi.org/project/rdagent/#files)
[![PyPI](https://img.shields.io/pypi/v/rdagent)](https://pypi.org/project/rdagent/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rdagent)](https://pypi.org/project/rdagent/)
[![Release](https://img.shields.io/github/v/release/microsoft/RD-Agent)](https://github.com/microsoft/RD-Agent/releases)
Expand Down
2 changes: 2 additions & 0 deletions rdagent/app/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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.utils.info import collect_info

load_dotenv()

Expand Down Expand Up @@ -46,5 +47,6 @@ def app():
"med_model": med_model,
"general_model": general_model,
"ui": ui,
"collect_info": collect_info,
}
)
86 changes: 86 additions & 0 deletions rdagent/app/utils/info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import importlib.metadata
import platform
import sys
from pathlib import Path

import docker
import requests
from setuptools_scm import get_version

from rdagent.log import rdagent_logger as logger


def sys_info():
"""collect system related info"""
method_list = [
["Name of current operating system: ", "system"],
["Processor architecture: ", "machine"],
["System, version, and hardware information: ", "platform"],
["Version number of the system: ", "version"],
]
for method in method_list:
logger.info(f"{method[0]}{getattr(platform, method[1])()}")
return None


def python_info():
"""collect Python related info"""
python_version = sys.version.replace("\n", " ")
logger.info(f"Python version: {python_version}")
return None


def docker_info():
client = docker.from_env()
containers = client.containers.list(all=True)
if containers:
containers.sort(key=lambda c: c.attrs["Created"])
last_container = containers[-1]
logger.info(f"Container ID: {last_container.id}")
logger.info(f"Container Name: {last_container.name}")
logger.info(f"Container Status: {last_container.status}")
logger.info(f"Image ID used by the container: {last_container.image.id}")
logger.info(f"Image tag used by the container: {last_container.image.tags}")
logger.info(f"Container port mapping: {last_container.ports}")
logger.info(f"Container Label: {last_container.labels}")
logger.info(f"Startup Commands: {' '.join(client.containers.get(last_container.id).attrs['Config']['Cmd'])}")
else:
logger.info(f"No run containers.")


def rdagent_info():
"""collect rdagent related info"""
current_version = importlib.metadata.version("rdagent")
logger.info(f"RD-Agent version: {current_version}")
api_url = f"https://api.github.com/repos/microsoft/RD-Agent/contents/requirements.txt?ref=main"
response = requests.get(api_url)
if response.status_code == 200:
files = response.json()
file_url = files["download_url"]
file_response = requests.get(file_url)
if file_response.status_code == 200:
all_file_contents = file_response.text.split("\n")
else:
logger.warning(f"Failed to retrieve {files['name']}, status code: {file_response.status_code}")
else:
logger.warning(f"Failed to retrieve files in folder, status code: {response.status_code}")
package_list = [
item.split("#")[0].strip() for item in all_file_contents if item.strip() and not item.startswith("#")
]
package_version_list = []
for package in package_list:
if package == "typer[all]":
package = "typer"
version = importlib.metadata.version(package)
package_version_list.append(f"{package}=={version}")
logger.info(f"Package version: {package_version_list}")
return None


def collect_info():
"""Prints information about the system and the installed packages."""
sys_info()
python_info()
docker_info()
rdagent_info()
return None
11 changes: 2 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tiktoken
pymupdf # Extract shotsreens from pdf

# azure identity related
azure.identity
azure-identity

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

# PDF related
pypdf
azure-core
azure-ai-formrecognizer

# factor implementations
tables

# azure identity related
azure.identity

# CI Fix Tool
tree-sitter-python
tree-sitter
Expand All @@ -72,6 +64,7 @@ selenium
kaggle

seaborn
setuptools-scm

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

0 comments on commit 89f4af9

Please sign in to comment.