Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ members = [
]

[workspace.package]
version = "0.2.69"
version = "0.2.70"
edition = "2024"
license = "MIT"
repository = "https://github.com/profullstack/c0mpute"
Expand Down
2 changes: 1 addition & 1 deletion apps/tui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@c0mpute/tui",
"version": "0.2.69",
"version": "0.2.70",
"private": true,
"type": "module",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c0mpute",
"version": "0.2.69",
"version": "0.2.70",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/releases/latest.json/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const dynamic = "force-dynamic";
* this in sync with the workspace version in `Cargo.toml` on each release so a
* freshly built CLI reports "already latest" rather than a phantom upgrade.
*/
const FALLBACK_VERSION = "0.2.69";
const FALLBACK_VERSION = "0.2.70";
const FALLBACK_MIN_REQUIRED = "0.0.1";

type Channel = "stable" | "beta" | "nightly";
Expand Down
29 changes: 29 additions & 0 deletions node/crates/c0mpute-core/src/diffusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,26 @@ pub fn can_serve(config: &crate::config::DiffusionConfig) -> bool {
&& installed()
&& fast_enough(config)
&& has_headroom_with(config, memory())
&& idle_enough_with(load_avg_1m(), logical_cpus())
&& node_slot().available_permits() > 0
}

/// Busiest a box may be (1-minute load average per logical CPU) and still
/// take a render. A render needs half the box for ~2 minutes; on a box
/// already this busy it takes 10+ and the buyer is better told "no worker".
pub const MAX_LOAD_PER_CPU: f64 = 0.75;

/// Pure decision: is the box idle enough to start an image now?
pub fn idle_enough_with(load_1m: f64, cpus: usize) -> bool {
cpus > 0 && load_1m.is_finite() && load_1m < cpus as f64 * MAX_LOAD_PER_CPU
}

fn load_avg_1m() -> f64 {
sysinfo::System::load_average().one
}

fn logical_cpus() -> usize {
std::thread::available_parallelism().map(|n| n.get()).unwrap_or(1)
}

fn now_secs() -> u64 {
Expand Down Expand Up @@ -708,6 +728,15 @@ mod tests {
assert_eq!(parse_stat("garbage"), None);
}

#[test]
fn a_busy_box_does_not_take_images() {
assert!(idle_enough_with(4.0, 16));
assert!(!idle_enough_with(26.5, 16), "seed2 at load 26 on 16 vCPUs");
assert!(!idle_enough_with(12.0, 16), "75% is the line");
assert!(!idle_enough_with(f64::NAN, 16));
assert!(!idle_enough_with(0.0, 0));
}

#[test]
fn png_magic_is_checked() {
assert!(is_png(b"\x89PNG\r\n\x1a\n0000"));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c0mpute-monorepo",
"version": "0.2.69",
"version": "0.2.70",
"private": true,
"workspaces": [
"apps/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@c0mpute/shared",
"version": "0.2.69",
"version": "0.2.70",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion plugins/ad-generator-agent/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[module]
id = "ad-generator-agent"
name = "Ad Generator Agent — every ad type from one URL"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "applications"
status = "available"
Expand Down
2 changes: 1 addition & 1 deletion plugins/ads-manager/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[module]
id = "ads-manager"
name = "Ads Manager — shared ad operations layer"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "applications"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/coinpay/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[module]
id = "coinpay"
name = "CoinPay — DID, payments, escrow, reputation"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "applications"
status = "available"
Expand Down
2 changes: 1 addition & 1 deletion plugins/crawl/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[module]
id = "crawl"
name = "Crawl — distributed web fetching"
version = "0.2.69"
version = "0.2.70"
kind = "workload"
category = "data"
status = "available"
Expand Down
2 changes: 1 addition & 1 deletion plugins/ctv-ads/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[module]
id = "ctv-ads"
name = "CTV Ads — Connected TV ad marketplace"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "applications"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/diffusion/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[module]
id = "diffusion"
name = "Diffusion — image generation"
version = "0.2.69"
version = "0.2.70"
kind = "workload"
category = "ai"
status = "available"
Expand Down
2 changes: 1 addition & 1 deletion plugins/embed/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[module]
id = "embed"
name = "Embeddings — vector generation"
version = "0.2.69"
version = "0.2.70"
kind = "workload"
category = "ai"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/gameserver/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[module]
id = "gameserver"
name = "Game server — Minecraft / Factorio / Valheim"
version = "0.2.69"
version = "0.2.70"
kind = "workload"
category = "infrastructure"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/hosting/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[module]
id = "hosting"
name = "Hosting — censorship-resistant static sites"
version = "0.2.69"
version = "0.2.70"
kind = "workload"
category = "data"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/infernet/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[module]
id = "infernet"
name = "Infernet Protocol — AI inference"
version = "0.2.69"
version = "0.2.70"
kind = "workload"
category = "ai"
status = "partial"
Expand Down
2 changes: 1 addition & 1 deletion plugins/live-stream/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
[module]
id = "live-stream"
name = "Live Stream — p2p HLS live streaming"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "media"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/ocr/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[module]
id = "ocr"
name = "OCR — document text extraction"
version = "0.2.69"
version = "0.2.70"
kind = "workload"
category = "ai"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/podcast-ads/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
[module]
id = "podcast-ads"
name = "Podcast Ads — audio ad marketplace"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "applications"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/podcasting/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[module]
id = "podcasting"
name = "Podcasting — p2p podcast publishing"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "media"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/podcasts/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
[module]
id = "podcasts"
name = "Podcasts — p2p podcast listener"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "media"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/render/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[module]
id = "render"
name = "Render — Blender 3D rendering"
version = "0.2.69"
version = "0.2.70"
kind = "workload"
category = "media"
status = "coming-soon"
Expand Down
2 changes: 1 addition & 1 deletion plugins/secure-chat/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[module]
id = "secure-chat"
name = "Secure Chat — E2E encrypted p2p messaging"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "applications"
status = "partial"
Expand Down
2 changes: 1 addition & 1 deletion plugins/storage/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[module]
id = "storage"
name = "Storage — Reed-Solomon shard service"
version = "0.2.69"
version = "0.2.70"
kind = "service"
category = "data"
status = "available"
Expand Down
Loading
Loading