Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New worker streaming tests #2032

Merged
merged 14 commits into from
Nov 17, 2024
6 changes: 0 additions & 6 deletions core/worker/lib/streaming/core/metrics.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
const { mean } = require('@hkube/stats');
const Logger = require('@hkube/logger');

const _calcRate = (list) => {
let first = list[0];
if (list.length === 1) {
first = { time: first.time - 2000, count: 0 };
}
const last = list[list.length - 1];

const log = Logger.GetLogFromContainer();
log.info(`STATISTICS: first value: ${first.count}, last value: ${last.count}, time diff: ${last.time - first.time} ms`);

const timeDiff = (last.time - first.time) / 1000;
const countDiff = last.count - first.count;
let rate = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/worker/lib/streaming/core/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Statistics {
stats.requests.add(this._createItem(requests));
stats.responses.add(this._createItem(responses));
stats.durations.addRange(netDurations);
stats.grossDurations.addRange(durations);
stats.grossDurations.addRange(durations); // used to calculate round trip
stats.queueDurations.addRange(queueDurations);

this._data[source] = {
Expand Down
77 changes: 77 additions & 0 deletions core/worker/test/mocks/pipeline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"name": "stream",
"kind": "stream",
"nodes": [
{
"nodeName": "A",
"algorithmName": "eval-alg",
"input": [
"@flowInput.arraySize",
"@flowInput.bufferSize"
],
"stateType": "stateful",
"maxStatelessCount": 0
},
{
"nodeName": "B",
"algorithmName": "eval-alg",
"input": [
"@flowInput.arraySize",
"@flowInput.bufferSize"
],
"stateType": "stateful"
},
{
"nodeName": "C",
"algorithmName": "eval-alg",
"input": [
"@flowInput.arraySize",
"@flowInput.bufferSize"
],
"stateType": "stateful"
},
{
"nodeName": "D",
"algorithmName": "eval-alg",
"input": [],
"stateType": "stateless"
},
{
"nodeName": "E",
"algorithmName": "eval-alg",
"input": [],
"stateType": "stateless",
"minStatelessCount": 10
},
{
"nodeName": "F",
"algorithmName": "eval-alg",
"input": [],
"stateType": "stateless",
"minStatelessCount": 3,
"maxStatelessCount": 2
}
],
"edges": [
{ "source": "A", "target": "D" },
{ "source": "B", "target": "D" },
{ "source": "C", "target": "D" },
{ "source": "A", "target": "E" },
{ "source": "B", "target": "E" },
{ "source": "C", "target": "F" }
],
"flowInputMetadata": {
"metadata": {
"flowInput.arraySize": {
"type": "number"
},
"flowInput.bufferSize": {
"type": "number"
}
},
"storageInfo": {
"path": "local-hkube/main:streaming:9dy12jfh/main:streaming:9dy12jfh"
}
}
}

Loading
Loading