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 {
|
} else {
|
||||||
let unknow_error_event = usage_stats::UsageStatsEvent::new(
|
let unknow_error_event = usage_stats::UsageStatsEvent::new(
|
||||||
ua.clone(),
|
ua.clone(),
|
||||||
usage_stats::EventType::Error("unknow_error".to_string()));
|
usage_stats::EventType::Error("unknow_error".to_string()),
|
||||||
|
);
|
||||||
unknow_error_event.send().await;
|
unknow_error_event.send().await;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
use csv::ReaderBuilder;
|
||||||
use reqwest::header::HeaderMap;
|
use reqwest::header::HeaderMap;
|
||||||
use serde::Serialize;
|
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 uuid::Uuid;
|
||||||
use csv::ReaderBuilder;
|
|
||||||
|
|
||||||
const TELEMETRY_URL: &str = "https://huggingface.co/api/telemetry/tgi";
|
const TELEMETRY_URL: &str = "https://huggingface.co/api/telemetry/tgi";
|
||||||
|
|
||||||
@ -229,11 +235,9 @@ impl XpuSmiInfo {
|
|||||||
fn new() -> Option<Vec<XpuSmiInfo>> {
|
fn new() -> Option<Vec<XpuSmiInfo>> {
|
||||||
let output = Command::new("xpu-smi")
|
let output = Command::new("xpu-smi")
|
||||||
.args(&[
|
.args(&[
|
||||||
"dump",
|
"dump", "-d", "-1", "-m",
|
||||||
"-d", "-1",
|
"0,1,3,17", // Metrics IDs: GPU Utilization, GPU Power, GPU Core Temperature, GPU Memory Bandwidth Utilization
|
||||||
"-m", "0,1,3,17", // Metrics IDs: GPU Utilization, GPU Power, GPU Core Temperature, GPU Memory Bandwidth Utilization
|
"-n", "1", "-j",
|
||||||
"-n", "1",
|
|
||||||
"-j",
|
|
||||||
])
|
])
|
||||||
.output()
|
.output()
|
||||||
.ok()?;
|
.ok()?;
|
||||||
@ -247,7 +251,7 @@ impl XpuSmiInfo {
|
|||||||
|
|
||||||
let json_data: serde_json::Value = match serde_json::from_str(&stdout) {
|
let json_data: serde_json::Value = match serde_json::from_str(&stdout) {
|
||||||
Ok(data) => data,
|
Ok(data) => data,
|
||||||
Err(_) => { return None }
|
Err(_) => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(metrics_data) = json_data.as_array() {
|
if let Some(metrics_data) = json_data.as_array() {
|
||||||
@ -270,10 +274,8 @@ impl XpuSmiInfo {
|
|||||||
|
|
||||||
Some(infos)
|
Some(infos)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Serialize, Debug, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
pub struct SystemInfo {
|
pub struct SystemInfo {
|
||||||
cpu_count: usize,
|
cpu_count: usize,
|
||||||
@ -334,10 +336,14 @@ pub fn is_container() -> io::Result<bool> {
|
|||||||
for line in reader.lines() {
|
for line in reader.lines() {
|
||||||
let line = line?;
|
let line = line?;
|
||||||
// Check for common container runtimes
|
// Check for common container runtimes
|
||||||
if line.contains("/docker/") || line.contains("/docker-") ||
|
if line.contains("/docker/")
|
||||||
line.contains("/kubepods/") || line.contains("/kubepods-") ||
|
|| line.contains("/docker-")
|
||||||
line.contains("containerd") || line.contains("crio") ||
|
|| line.contains("/kubepods/")
|
||||||
line.contains("podman") {
|
|| line.contains("/kubepods-")
|
||||||
|
|| line.contains("containerd")
|
||||||
|
|| line.contains("crio")
|
||||||
|
|| line.contains("podman")
|
||||||
|
{
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user