Skip to content

Commit da7c0a4

Browse files
committed
added exec platform info
1 parent 831e087 commit da7c0a4

File tree

6 files changed

+30
-12
lines changed

6 files changed

+30
-12
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default-members = ["compute"]
77

88
[workspace.package]
99
edition = "2021"
10-
version = "0.6.0"
10+
version = "0.6.1"
1111
license = "Apache-2.0"
1212
readme = "README.md"
1313

compute/src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ pub struct DriaComputeNodeConfig {
3939
///
4040
/// TODO: this is `None` after startup due to `Option::take`, can we do any better?
4141
pub initial_rpc_addr: Option<Multiaddr>,
42+
/// Execution platform, mainly for diagnostics.
43+
///
44+
/// Given by `DKN_EXEC_PLATFORM`.
45+
pub exec_platform: String,
4246
}
4347

4448
#[allow(clippy::new_without_default)]
@@ -118,6 +122,9 @@ impl DriaComputeNodeConfig {
118122
Multiaddr::from_str(&addr).expect("could not parse the given initial RPC address.")
119123
});
120124

125+
// parse execution platform
126+
let exec_platform = env::var("DKN_EXEC_PLATFORM").unwrap_or_else(|_| "unknown".to_string());
127+
121128
Self {
122129
secret_key,
123130
public_key,
@@ -129,6 +136,7 @@ impl DriaComputeNodeConfig {
129136
network: network_type,
130137
batch_size,
131138
initial_rpc_addr,
139+
exec_platform,
132140
}
133141
}
134142

compute/src/node/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ impl DriaComputeNode {
126126
let model_names = config.executors.get_model_names();
127127
let points_client = DriaPointsClient::new(&config.address, &config.network)?;
128128

129-
let spec_collector = SpecCollector::new(model_names.clone(), model_perf, config.version);
129+
let spec_collector = SpecCollector::new(
130+
model_names.clone(),
131+
model_perf,
132+
config.version,
133+
config.exec_platform.clone(),
134+
);
130135
Ok((
131136
DriaComputeNode {
132137
config,

compute/src/utils/specs.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,20 @@ pub struct SpecCollector {
1717
model_perf: HashMap<String, SpecModelPerformance>,
1818
/// Version string.
1919
version: String,
20+
/// Execution platform, mainly for diagnostics.
21+
exec_platform: String,
2022
// GPU adapter infos, showing information about the available GPUs.
2123
// gpus: Vec<wgpu::AdapterInfo>,
2224
}
2325

24-
// impl Default for SpecCollector {
25-
// fn default() -> Self {
26-
// Self::new(vec![], SemanticVersion::default())
27-
// }
28-
// }
29-
3026
impl SpecCollector {
3127
pub fn new(
3228
models: Vec<String>,
3329
model_perf: HashMap<Model, SpecModelPerformance>,
3430
version: SemanticVersion,
31+
exec_platform: String,
3532
) -> Self {
33+
log::debug!("Creating spec collector with version {version} and platform {exec_platform}");
3634
SpecCollector {
3735
system: sysinfo::System::new_with_specifics(Self::get_refresh_specifics()),
3836
models,
@@ -41,6 +39,7 @@ impl SpecCollector {
4139
.map(|(k, v)| (k.to_string(), v))
4240
.collect(),
4341
version: version.to_string(),
42+
exec_platform,
4443
// gpus: wgpu::Instance::default()
4544
// .enumerate_adapters(wgpu::Backends::all())
4645
// .into_iter()
@@ -72,6 +71,7 @@ impl SpecCollector {
7271
models: self.models.clone(),
7372
version: self.version.clone(),
7473
model_perf: self.model_perf.clone(),
74+
exec_platform: self.exec_platform.clone(),
7575
// gpus: self.gpus.clone(),
7676
}
7777
}
@@ -94,6 +94,7 @@ mod tests {
9494
minor: 5,
9595
patch: 1,
9696
},
97+
"testing".to_string(),
9798
);
9899
let specs = spec_collector.collect().await;
99100
assert!(specs.total_mem > 0);
@@ -104,7 +105,9 @@ mod tests {
104105
assert!(!specs.arch.is_empty());
105106
assert!(specs.lookup.is_some());
106107
assert!(!specs.models.is_empty());
108+
assert_eq!(specs.model_perf.len(), 3);
107109
assert_eq!(specs.version, "4.5.1");
110+
assert_eq!(specs.exec_platform, "testing");
108111

109112
// should be serializable to JSON
110113
assert!(serde_json::to_string_pretty(&specs).is_ok())

utils/src/payloads/specs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ pub struct Specs {
4646
pub model_perf: HashMap<String, SpecModelPerformance>,
4747
/// Node version, e.g. `0.1.0`.
4848
pub version: String,
49+
/// Name of the execution platform, e.g. Docker file or Launcher.
50+
pub exec_platform: String,
4951
// GPU adapter infos, showing information about the available GPUs.
5052
// gpus: Vec<wgpu::AdapterInfo>,
5153
}

0 commit comments

Comments
 (0)