MCPcopy Create free account
hub / github.com/evilsocket/cake / run_zero_config_worker

Function run_zero_config_worker

cake-mobile/src/lib.rs:329–459  ·  view source on GitHub ↗
(
    name: &str,
    cluster_key: &str,
    address: &str,
    cache_dir: &std::path::Path,
    _model: &str,
)

Source from the content-addressed store, hash-verified

327// ---------------------------------------------------------------------------
328
329async fn run_zero_config_worker(
330 name: &str,
331 cluster_key: &str,
332 address: &str,
333 cache_dir: &std::path::Path,
334 _model: &str,
335) -> String {
336 let progress_cb = |stage: &str, message: &str, progress: f64| {
337 update_status(stage, message, progress);
338 };
339
340 let (layers, model_path, listener) = match cake::sharding::worker_setup_with_progress(
341 name,
342 cluster_key,
343 address,
344 cache_dir,
345 Some(&progress_cb),
346 )
347 .await
348 {
349 Ok(result) => result,
350 Err(e) => {
351 update_status("error", &format!("Setup failed: {}", e), 0.0);
352 return format!("worker setup failed: {}", e);
353 }
354 };
355
356 log_mobile(&format!("[cake-mobile] master assigned layers: {:?}", layers));
357 log_mobile(&format!("[cake-mobile] model path: {}", model_path.display()));
358
359 let mut topology = Topology::new();
360 topology.insert(
361 name.to_string(),
362 cake::Node {
363 host: address.to_string(),
364 description: None,
365 layers: layers.clone(),
366 vram_bytes: 0,
367 tflops: 0.0,
368 backend: String::new(),
369 hostname: String::new(),
370 os: String::new(),
371 },
372 );
373
374 let force_cpu = should_force_cpu();
375 if force_cpu {
376 log_mobile("[cake-mobile] GPU not supported on this device, using CPU backend");
377 }
378
379 let args = Args {
380 address: address.to_string(),
381 mode: Mode::Worker,
382 name: Some(name.to_string()),
383 model: model_path.to_string_lossy().to_string(),
384 model_type: ModelType::TextModel,
385 topology_override: Some(topology),
386 cpu: force_cpu,

Callers 1

start_workerFunction · 0.85

Calls 8

update_statusFunction · 0.85
log_mobileFunction · 0.85
should_force_cpuFunction · 0.85
layers_to_rangeFunction · 0.85
update_serving_statusFunction · 0.85
run_text_workerFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected