feat: add slice calculator integration and marketplace SLA for grid nodes

This commit is contained in:
mik-tf
2025-09-08 23:47:02 -04:00
parent 138f67e02e
commit 52316319e6
7 changed files with 862 additions and 87 deletions

View File

@@ -150,6 +150,232 @@
"group_slice_price": null,
"last_seen": "2025-09-09T03:03:44.241206636Z",
"health_score": 100.0
},
{
"id": "grid_node_10",
"location": "Unknown, Belgium",
"status": "Online",
"capacity": {
"cpu_cores": 8,
"memory_gb": 15,
"storage_gb": 402559,
"bandwidth_mbps": 1000,
"ssd_storage_gb": 223,
"hdd_storage_gb": 402336,
"ram_gb": 15
},
"used_capacity": {
"cpu_cores": 4,
"memory_gb": 10,
"storage_gb": 137,
"bandwidth_mbps": 0,
"ssd_storage_gb": 137,
"hdd_storage_gb": 0,
"ram_gb": 10
},
"uptime_percentage": 99.0,
"farming_start_date": "2025-08-10T03:10:19.936729614Z",
"last_updated": "2025-09-09T03:10:19.936733378Z",
"utilization_7_day_avg": 65.0,
"slice_formats_supported": [
"1x1",
"2x2",
"4x4"
],
"rental_options": null,
"total_base_slices": 0,
"allocated_base_slices": 0,
"earnings_today_usd": 0.0,
"grid_node_id": "10",
"available_combinations": [],
"slice_allocations": [],
"slice_last_calculated": null,
"marketplace_sla": {
"id": "sla-repair-e3b05c2c-5eb6-4304-93c0-7a9c7348636a",
"name": "Repaired Node SLA",
"uptime_guarantee": 99.8,
"response_time_hours": 24,
"resolution_time_hours": 48,
"penalty_rate": 0.01,
"uptime_guarantee_percentage": 99.8,
"base_slice_price": 0.5,
"bandwidth_guarantee_mbps": 100.0,
"last_updated": "2025-09-09T03:13:53.570999450Z"
},
"slice_pricing": {
"base_price_per_hour": 1.0,
"currency": "USD",
"pricing_multiplier": 1.0
},
"grid_data": {
"capacity": {
"bandwidth_mbps": 1000,
"cpu_cores": 8,
"hdd_storage_gb": 402336,
"memory_gb": 15,
"ram_gb": 15,
"ssd_storage_gb": 223,
"storage_gb": 402559
},
"certification_type": "Diy",
"city": "Unknown",
"country": "Belgium",
"farm_id": 1,
"farm_name": "Freefarm",
"farming_policy_id": 1,
"grid_node_id": 10,
"last_updated": "2025-09-09T03:10:19.936676347Z",
"location": "Unknown, Belgium",
"node_id": 10,
"public_ips": [
"192.168.1.100"
],
"status": "Online",
"total_resources": {
"bandwidth_mbps": 1000,
"cpu_cores": 8,
"hdd_storage_gb": 402336,
"memory_gb": 15,
"ram_gb": 15,
"ssd_storage_gb": 223,
"storage_gb": 402559
},
"uptime": 99.5,
"used_resources": {
"bandwidth_mbps": 0,
"cpu_cores": 4,
"hdd_storage_gb": 0,
"memory_gb": 10,
"ram_gb": 10,
"ssd_storage_gb": 137,
"storage_gb": 137
}
},
"slice_formats": null,
"name": "Grid Node 10",
"region": "Belgium",
"node_type": "MyceliumNode",
"staking_options": null,
"availability_status": "Available",
"node_group_id": null,
"group_assignment_date": null,
"group_slice_format": null,
"group_slice_price": null,
"last_seen": "2025-09-09T03:10:19.936736220Z",
"health_score": 100.0
},
{
"id": "grid_node_12",
"location": "Unknown, Belgium",
"status": "Online",
"capacity": {
"cpu_cores": 8,
"memory_gb": 15,
"storage_gb": 402559,
"bandwidth_mbps": 1000,
"ssd_storage_gb": 223,
"hdd_storage_gb": 402336,
"ram_gb": 15
},
"used_capacity": {
"cpu_cores": 5,
"memory_gb": 12,
"storage_gb": 165,
"bandwidth_mbps": 0,
"ssd_storage_gb": 165,
"hdd_storage_gb": 0,
"ram_gb": 12
},
"uptime_percentage": 99.0,
"farming_start_date": "2025-08-10T03:30:24.732131670Z",
"last_updated": "2025-09-09T03:30:24.732143334Z",
"utilization_7_day_avg": 65.0,
"slice_formats_supported": [
"1x1",
"2x2",
"4x4"
],
"rental_options": null,
"total_base_slices": 0,
"allocated_base_slices": 0,
"earnings_today_usd": 0.0,
"grid_node_id": "12",
"available_combinations": [],
"slice_allocations": [],
"slice_last_calculated": null,
"marketplace_sla": {
"id": "sla-repair-25c05a40-790f-4a80-8ef8-fa12a726c0ff",
"name": "Repaired Node SLA",
"uptime_guarantee": 99.8,
"response_time_hours": 24,
"resolution_time_hours": 48,
"penalty_rate": 0.01,
"uptime_guarantee_percentage": 99.8,
"base_slice_price": 0.5,
"bandwidth_guarantee_mbps": 100.0,
"last_updated": "2025-09-09T03:30:27.416132016Z"
},
"slice_pricing": {
"base_price_per_hour": 1.0,
"currency": "USD",
"pricing_multiplier": 1.0
},
"grid_data": {
"capacity": {
"bandwidth_mbps": 1000,
"cpu_cores": 8,
"hdd_storage_gb": 402336,
"memory_gb": 15,
"ram_gb": 15,
"ssd_storage_gb": 223,
"storage_gb": 402559
},
"certification_type": "Diy",
"city": "Unknown",
"country": "Belgium",
"farm_id": 1,
"farm_name": "Freefarm",
"farming_policy_id": 1,
"grid_node_id": 12,
"last_updated": "2025-09-09T03:30:24.731928799Z",
"location": "Unknown, Belgium",
"node_id": 12,
"public_ips": [
"192.168.1.100"
],
"status": "Online",
"total_resources": {
"bandwidth_mbps": 1000,
"cpu_cores": 8,
"hdd_storage_gb": 402336,
"memory_gb": 15,
"ram_gb": 15,
"ssd_storage_gb": 223,
"storage_gb": 402559
},
"uptime": 99.5,
"used_resources": {
"bandwidth_mbps": 0,
"cpu_cores": 5,
"hdd_storage_gb": 0,
"memory_gb": 12,
"ram_gb": 12,
"ssd_storage_gb": 165,
"storage_gb": 165
}
},
"slice_formats": null,
"name": "Grid Node 12",
"region": "Belgium",
"node_type": "MyceliumNode",
"staking_options": null,
"availability_status": "Available",
"node_group_id": null,
"group_assignment_date": null,
"group_slice_format": null,
"group_slice_price": null,
"last_seen": "2025-09-09T03:30:24.732150580Z",
"health_score": 100.0
}
],
"resource_provider_earnings": [],

View File

@@ -0,0 +1,15 @@
{
"user_id": "user123@example.com",
"items": [
{
"product_id": "user_user0_example_com_fa373486",
"quantity": 1,
"selected_specifications": {},
"added_at": "2025-09-09T03:32:30.573242755Z",
"updated_at": "2025-09-09T03:32:30.573242755Z"
}
],
"session_id": null,
"created_at": "2025-09-09T03:32:30.573133861Z",
"updated_at": "2025-09-09T03:32:30.573271484Z"
}

View File

@@ -18,7 +18,121 @@
"deleted": null,
"deleted_at": null,
"deletion_reason": null,
"nodes": [],
"nodes": [
{
"id": "grid_node_2007",
"location": "Unknown, Belgium",
"status": "Online",
"capacity": {
"cpu_cores": 24,
"memory_gb": 188,
"storage_gb": 8859,
"bandwidth_mbps": 1000,
"ssd_storage_gb": 476,
"hdd_storage_gb": 8383,
"ram_gb": 188
},
"used_capacity": {
"cpu_cores": 9,
"memory_gb": 55,
"storage_gb": 343,
"bandwidth_mbps": 0,
"ssd_storage_gb": 343,
"hdd_storage_gb": 0,
"ram_gb": 55
},
"uptime_percentage": 99.0,
"farming_start_date": "2025-08-10T03:27:08.942256607Z",
"last_updated": "2025-09-09T03:27:08.942268123Z",
"utilization_7_day_avg": 65.0,
"slice_formats_supported": [
"1x1",
"2x2",
"4x4"
],
"rental_options": null,
"total_base_slices": 0,
"allocated_base_slices": 0,
"earnings_today_usd": 0.0,
"grid_node_id": "2007",
"available_combinations": [],
"slice_allocations": [],
"slice_last_calculated": null,
"marketplace_sla": {
"id": "sla-repair-8fa25e61-493a-46cc-b942-ce8cef923ae6",
"name": "Repaired Node SLA",
"uptime_guarantee": 99.8,
"response_time_hours": 24,
"resolution_time_hours": 48,
"penalty_rate": 0.01,
"uptime_guarantee_percentage": 99.8,
"base_slice_price": 0.5,
"bandwidth_guarantee_mbps": 100.0,
"last_updated": "2025-09-09T03:27:12.489433171Z"
},
"slice_pricing": {
"base_price_per_hour": 1.0,
"currency": "USD",
"pricing_multiplier": 1.0
},
"grid_data": {
"capacity": {
"bandwidth_mbps": 1000,
"cpu_cores": 24,
"hdd_storage_gb": 8383,
"memory_gb": 188,
"ram_gb": 188,
"ssd_storage_gb": 476,
"storage_gb": 8859
},
"certification_type": "Diy",
"city": "Unknown",
"country": "Belgium",
"farm_id": 1,
"farm_name": "Freefarm",
"farming_policy_id": 1,
"grid_node_id": 2007,
"last_updated": "2025-09-09T03:27:08.942100965Z",
"location": "Unknown, Belgium",
"node_id": 2007,
"public_ips": [
"192.168.1.100"
],
"status": "Online",
"total_resources": {
"bandwidth_mbps": 1000,
"cpu_cores": 24,
"hdd_storage_gb": 8383,
"memory_gb": 188,
"ram_gb": 188,
"ssd_storage_gb": 476,
"storage_gb": 8859
},
"uptime": 99.5,
"used_resources": {
"bandwidth_mbps": 0,
"cpu_cores": 9,
"hdd_storage_gb": 0,
"memory_gb": 55,
"ram_gb": 55,
"ssd_storage_gb": 343,
"storage_gb": 343
}
},
"slice_formats": null,
"name": "Grid Node 2007",
"region": "Belgium",
"node_type": "MyceliumNode",
"staking_options": null,
"availability_status": "Available",
"node_group_id": null,
"group_assignment_date": null,
"group_slice_format": null,
"group_slice_price": null,
"last_seen": "2025-09-09T03:27:08.942273898Z",
"health_score": 100.0
}
],
"resource_provider_earnings": [],
"resource_provider_settings": null,
"slice_products": [],
@@ -29,7 +143,91 @@
"active_product_rentals": [],
"resource_provider_rental_earnings": [],
"node_rentals": [],
"node_groups": [],
"node_groups": [
{
"id": "compute",
"name": "Compute",
"description": "General compute workloads",
"node_ids": [],
"group_type": {
"Default": "compute"
},
"updated_at": "2025-09-09T03:26:57.639840151Z",
"created_at": "2025-09-09T03:26:57.639836172Z",
"group_config": {
"group_name": "Compute Nodes",
"max_nodes": 100,
"allocation_strategy": "balanced",
"auto_scaling": true,
"preferred_slice_formats": [
"1x1",
"2x2"
],
"default_pricing": 50.0,
"resource_optimization": {
"cpu_optimization": 0.5,
"memory_optimization": 0.5,
"storage_optimization": 0.5,
"network_optimization": 0.5
}
}
},
{
"id": "storage",
"name": "Storage",
"description": "Storage and data workloads",
"node_ids": [],
"group_type": {
"Default": "storage"
},
"updated_at": "2025-09-09T03:26:57.639846621Z",
"created_at": "2025-09-09T03:26:57.639846284Z",
"group_config": {
"group_name": "Storage Nodes",
"max_nodes": 50,
"allocation_strategy": "storage_optimized",
"auto_scaling": false,
"preferred_slice_formats": [
"1x1"
],
"default_pricing": 30.0,
"resource_optimization": {
"cpu_optimization": 0.3,
"memory_optimization": 0.3,
"storage_optimization": 0.8,
"network_optimization": 0.6
}
}
},
{
"id": "ai-gpu",
"name": "AI/GPU",
"description": "AI and GPU-intensive workloads",
"node_ids": [],
"group_type": {
"Default": "ai-gpu"
},
"updated_at": "2025-09-09T03:26:57.639850994Z",
"created_at": "2025-09-09T03:26:57.639850646Z",
"group_config": {
"group_name": "AI/GPU Nodes",
"max_nodes": 20,
"allocation_strategy": "gpu_optimized",
"auto_scaling": true,
"preferred_slice_formats": [
"4x4",
"8x8"
],
"default_pricing": 200.0,
"resource_optimization": {
"cpu_optimization": 0.8,
"memory_optimization": 0.7,
"storage_optimization": 0.4,
"network_optimization": 0.5
}
}
}
],
"slice_rentals": [],
"slice_assignments": [],
"display_currency": "MC",