mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
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 <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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
[](https://github.com/microsoft/RD-Agent/actions/workflows/pr.yml)
|
||||
[](https://github.com/microsoft/RD-Agent/actions/workflows/readthedocs-preview.yml)
|
||||
[](https://github.com/microsoft/RD-Agent/actions/workflows/release.yml)
|
||||
[](https://pypi.org/project/rdagent/#files)
|
||||
[](https://pypi.org/project/rdagent/)
|
||||
[](https://pypi.org/project/rdagent/)
|
||||
[](https://github.com/microsoft/RD-Agent/releases)
|
||||
|
||||
@@ -18,6 +18,7 @@ from rdagent.app.general_model.general_model import (
|
||||
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()
|
||||
|
||||
@@ -46,5 +47,6 @@ def app():
|
||||
"med_model": med_model,
|
||||
"general_model": general_model,
|
||||
"ui": ui,
|
||||
"collect_info": collect_info,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -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
|
||||
+2
-9
@@ -28,7 +28,7 @@ tiktoken
|
||||
pymupdf # Extract shotsreens from pdf
|
||||
|
||||
# azure identity related
|
||||
azure.identity
|
||||
azure-identity
|
||||
|
||||
# PDF related
|
||||
pypdf
|
||||
@@ -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
|
||||
@@ -72,6 +64,7 @@ selenium
|
||||
kaggle
|
||||
|
||||
seaborn
|
||||
setuptools-scm
|
||||
|
||||
# This is a temporary package installed to pass the test_import test
|
||||
xgboost
|
||||
|
||||
Reference in New Issue
Block a user