mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
de8e310d6b
* 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>
87 lines
3.1 KiB
Python
87 lines
3.1 KiB
Python
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
|