mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-12 04:44:52 +00:00
cargo fmt
This commit is contained in:
parent
b6f713d77c
commit
d567280265
@ -475,7 +475,8 @@ async fn main() -> Result<(), RouterError> {
|
||||
} else {
|
||||
let unknow_error_event = usage_stats::UsageStatsEvent::new(
|
||||
ua.clone(),
|
||||
usage_stats::EventType::Error("unknow_error".to_string()));
|
||||
usage_stats::EventType::Error("unknow_error".to_string()),
|
||||
);
|
||||
unknow_error_event.send().await;
|
||||
}
|
||||
};
|
||||
|
@ -1,9 +1,15 @@
|
||||
use crate::config::Config;
|
||||
use csv::ReaderBuilder;
|
||||
use reqwest::header::HeaderMap;
|
||||
use serde::Serialize;
|
||||
use std::{fs::File, io::{self, BufRead}, path::Path, process::Command, time::Duration};
|
||||
use std::{
|
||||
fs::File,
|
||||
io::{self, BufRead},
|
||||
path::Path,
|
||||
process::Command,
|
||||
time::Duration,
|
||||
};
|
||||
use uuid::Uuid;
|
||||
use csv::ReaderBuilder;
|
||||
|
||||
const TELEMETRY_URL: &str = "https://huggingface.co/api/telemetry/tgi";
|
||||
|
||||
@ -229,11 +235,9 @@ impl XpuSmiInfo {
|
||||
fn new() -> Option<Vec<XpuSmiInfo>> {
|
||||
let output = Command::new("xpu-smi")
|
||||
.args(&[
|
||||
"dump",
|
||||
"-d", "-1",
|
||||
"-m", "0,1,3,17", // Metrics IDs: GPU Utilization, GPU Power, GPU Core Temperature, GPU Memory Bandwidth Utilization
|
||||
"-n", "1",
|
||||
"-j",
|
||||
"dump", "-d", "-1", "-m",
|
||||
"0,1,3,17", // Metrics IDs: GPU Utilization, GPU Power, GPU Core Temperature, GPU Memory Bandwidth Utilization
|
||||
"-n", "1", "-j",
|
||||
])
|
||||
.output()
|
||||
.ok()?;
|
||||
@ -247,7 +251,7 @@ impl XpuSmiInfo {
|
||||
|
||||
let json_data: serde_json::Value = match serde_json::from_str(&stdout) {
|
||||
Ok(data) => data,
|
||||
Err(_) => { return None }
|
||||
Err(_) => return None,
|
||||
};
|
||||
|
||||
if let Some(metrics_data) = json_data.as_array() {
|
||||
@ -270,10 +274,8 @@ impl XpuSmiInfo {
|
||||
|
||||
Some(infos)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#[derive(Serialize, Debug, Clone)]
|
||||
pub struct SystemInfo {
|
||||
cpu_count: usize,
|
||||
@ -334,10 +336,14 @@ pub fn is_container() -> io::Result<bool> {
|
||||
for line in reader.lines() {
|
||||
let line = line?;
|
||||
// Check for common container runtimes
|
||||
if line.contains("/docker/") || line.contains("/docker-") ||
|
||||
line.contains("/kubepods/") || line.contains("/kubepods-") ||
|
||||
line.contains("containerd") || line.contains("crio") ||
|
||||
line.contains("podman") {
|
||||
if line.contains("/docker/")
|
||||
|| line.contains("/docker-")
|
||||
|| line.contains("/kubepods/")
|
||||
|| line.contains("/kubepods-")
|
||||
|| line.contains("containerd")
|
||||
|| line.contains("crio")
|
||||
|| line.contains("podman")
|
||||
{
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user