This commit is contained in:
2024-06-28 11:58:02 +03:00
parent da56ec65d3
commit 5c7e78d39f
4 changed files with 19 additions and 2 deletions

View File

@ -23,6 +23,8 @@ namespace AZ.Compute.Agent
NetworkInterface nic; NetworkInterface nic;
ulong totalNetworkBytes; ulong totalNetworkBytes;
const double nicSpeed = 10 * 1024 * 1024; // 10 MBps
[Export] string id; [Export] string id;
[Export] string ip; [Export] string ip;
@ -103,7 +105,9 @@ namespace AZ.Compute.Agent
var ntb = (ulong)nic.GetIPv4Statistics().BytesReceived + (ulong)nic.GetIPv4Statistics().BytesSent; var ntb = (ulong)nic.GetIPv4Statistics().BytesReceived + (ulong)nic.GetIPv4Statistics().BytesSent;
network = (float)(((ntb - totalNetworkBytes) / 5.0) / nic.Speed); network = (float)(((ntb - totalNetworkBytes) / 5.0) / nicSpeed);
totalNetworkBytes = ntb;
Cpu = cpuCounter.NextValue(); Cpu = cpuCounter.NextValue();
Ram = ramCounter.NextValue(); Ram = ramCounter.NextValue();

View File

@ -26,6 +26,14 @@ namespace AZ.Compute
[Export] [Export]
public void Compute(string fileName, string arguments) public void Compute(string fileName, string arguments)
{ {
if (fileName.Contains(" "))
{
var sc = fileName.Split(' ', 2);
fileName = sc[0];
arguments = sc[1];
}
// هنا ينحط الكود مال الغورثمية الي تستنكي افضل ايجينت حتى تشغل التاسك عليه // هنا ينحط الكود مال الغورثمية الي تستنكي افضل ايجينت حتى تشغل التاسك عليه
//Agents.First().Compute(fileName, arguments); //Agents.First().Compute(fileName, arguments);

View File

@ -57,7 +57,7 @@
<div class="content" async:data="d?.get('sys/service')"> <div class="content" async:data="d?.get('sys/service')">
<i-repeat :data="d?.Agents"> <i-repeat :data="d?.Agents" id="list">
<table class="table-list"> <table class="table-list">
<thead> <thead>
<tr> <tr>

View File

@ -29,6 +29,8 @@ async function addJob() {
alert(ex); alert(ex);
} }
} }
document.getElementById("list").update();
} }
async function addAgent() { async function addAgent() {
@ -41,6 +43,9 @@ async function addAgent() {
alert(ex); alert(ex);
} }
} }
document.getElementById("list").update();
} }
const FORMAT_CONNECTION_STATUS = (x) => ["Offline", "Connecting...", "Online"][x]; const FORMAT_CONNECTION_STATUS = (x) => ["Offline", "Connecting...", "Online"][x];