fixing wamo-line
This commit is contained in:
parent
9e305ebef0
commit
f2b0e1ab7b
@ -2,7 +2,7 @@
|
|||||||
* @author Martin Karkowski
|
* @author Martin Karkowski
|
||||||
* @email m.karkowski@zema.de
|
* @email m.karkowski@zema.de
|
||||||
* @create date 2020-03-02 11:37:50
|
* @create date 2020-03-02 11:37:50
|
||||||
* @modify date 2021-01-06 15:48:34
|
* @modify date 2021-01-14 12:12:15
|
||||||
* @desc [description]
|
* @desc [description]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ export class WaMOBaseModule
|
|||||||
|
|
||||||
// Demo-Mode
|
// Demo-Mode
|
||||||
// Wait 10 Seconds at least spend additional 0-5000 Seconds
|
// Wait 10 Seconds at least spend additional 0-5000 Seconds
|
||||||
await sleep(Math.random() * 5000 + 10000);
|
await sleep(Math.random() * 5000 + 1000);
|
||||||
|
|
||||||
_this._logger.info("waited => release");
|
_this._logger.info("waited => release");
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @author Martin Karkowski
|
* @author Martin Karkowski
|
||||||
* @email m.karkowski@zema.de
|
* @email m.karkowski@zema.de
|
||||||
* @create date 2020-03-02 11:37:50
|
* @create date 2020-03-02 11:37:50
|
||||||
* @modify date 2021-01-06 16:59:20
|
* @modify date 2021-01-14 12:08:07
|
||||||
* @desc [description]
|
* @desc [description]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ export class WaMOSimpleTransportManager
|
|||||||
this.config.setContent(options);
|
this.config.setContent(options);
|
||||||
|
|
||||||
await this.initialized.waitFor((value) => value);
|
await this.initialized.waitFor((value) => value);
|
||||||
await this.flush();
|
// await this.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,6 +141,7 @@ class OverviewComponent extends React.Component<
|
|||||||
></AvailableDispatchers>
|
></AvailableDispatchers>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
{this.state.instances.length > 0 ? (
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
<Jumbotron>
|
<Jumbotron>
|
||||||
@ -171,6 +172,43 @@ class OverviewComponent extends React.Component<
|
|||||||
</Jumbotron>
|
</Jumbotron>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
{this.state.instances.length > 0 ? (
|
||||||
|
<Row>
|
||||||
|
<Col>
|
||||||
|
<Jumbotron>
|
||||||
|
<h1>Instances</h1>
|
||||||
|
<p>The Following instances has been found:</p>
|
||||||
|
<Table striped bordered hover>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Identifier</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{this.state.instances.map((instance) => {
|
||||||
|
return (
|
||||||
|
<tr key={idx++}>
|
||||||
|
<td>{instance.identifier}</td>
|
||||||
|
<td>
|
||||||
|
<code>{instance.type}</code>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</Table>
|
||||||
|
</Jumbotron>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -17,7 +17,7 @@ import { INopeObserver } from "../../lib/types/nope/nopeObservable.interface";
|
|||||||
/**
|
/**
|
||||||
* Component used to render the Status of the Memory of a Host.
|
* Component used to render the Status of the Memory of a Host.
|
||||||
*/
|
*/
|
||||||
class MemoryStatusComponent extends React.Component<
|
class MemoryStatusOfHostComponent extends React.Component<
|
||||||
{
|
{
|
||||||
value: number;
|
value: number;
|
||||||
},
|
},
|
||||||
@ -139,9 +139,9 @@ class HostStatusComponent extends React.Component<
|
|||||||
<td>
|
<td>
|
||||||
{" "}
|
{" "}
|
||||||
{/* Rendert the Memory */}
|
{/* Rendert the Memory */}
|
||||||
<MemoryStatusComponent
|
<MemoryStatusOfHostComponent
|
||||||
value={this.props.status.ram}
|
value={this.props.status.ram}
|
||||||
></MemoryStatusComponent>
|
></MemoryStatusOfHostComponent>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
) : (
|
) : (
|
||||||
|
@ -1,36 +1,39 @@
|
|||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { EventLayer } from "../lib/communication/eventLayer";
|
import { EventLayer } from "../lib/communication/eventLayer";
|
||||||
|
import { exportFunctionToDispatcher } from "../lib/decorators/dispatcherDecorators";
|
||||||
import { getLinkedDispatcher } from "../lib/dispatcher/getLinkedDispatcher";
|
import { getLinkedDispatcher } from "../lib/dispatcher/getLinkedDispatcher";
|
||||||
import { nopeDispatcher } from "../lib/dispatcher/nopeDispatcher";
|
import { nopeDispatcher } from "../lib/dispatcher/nopeDispatcher";
|
||||||
import { exportFunctionToDispatcher } from "../lib/dispatcher/nopeDispatcherDecorators";
|
|
||||||
import { NopeObservable } from "../lib/observables/NopeObservable";
|
import { NopeObservable } from "../lib/observables/NopeObservable";
|
||||||
import { IRemoteInstance } from "../lib/types/remoteInstance.interface";
|
|
||||||
import { generateBenchmarkFunction } from "../modules/funcs/generateBenchmarkFunction";
|
import { generateBenchmarkFunction } from "../modules/funcs/generateBenchmarkFunction";
|
||||||
|
|
||||||
|
|
||||||
const max = 100000;
|
const max = 100000;
|
||||||
const communicator = new EventLayer(
|
const communicator = new EventLayer();
|
||||||
"generic",
|
|
||||||
"generic"
|
|
||||||
);
|
|
||||||
const local = new nopeDispatcher({ communicator }, () => new NopeObservable());
|
const local = new nopeDispatcher({ communicator }, () => new NopeObservable());
|
||||||
const _functionRemote = exportFunctionToDispatcher(async (a: number, b: number, operation: (a: number, b: number) => number) => {
|
|
||||||
|
const _functionRemote = exportFunctionToDispatcher(
|
||||||
|
async (a: number, b: number, operation: (a: number, b: number) => number) => {
|
||||||
return await operation(a, b);
|
return await operation(a, b);
|
||||||
}, {
|
},
|
||||||
uri: "functionRemote"
|
{
|
||||||
});
|
id: "functionRemote"
|
||||||
const _benchmark = exportFunctionToDispatcher(generateBenchmarkFunction(max, ""), {
|
}
|
||||||
uri: "benchmark"
|
);
|
||||||
});
|
const _benchmark = exportFunctionToDispatcher(
|
||||||
|
generateBenchmarkFunction(max, "remote-dispatcher"),
|
||||||
|
{
|
||||||
|
id: "benchmark"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const remote = getLinkedDispatcher({ communicator });
|
const remote = getLinkedDispatcher({ communicator });
|
||||||
const remoteObservable = new NopeObservable<number>();
|
const remoteObservable = new NopeObservable<number>();
|
||||||
remote.registerObservable(remoteObservable, {
|
remote.registerObservable(remoteObservable, {
|
||||||
mode: "publish",
|
mode: "publish",
|
||||||
topic: "topic"
|
topic: "topic",
|
||||||
|
schema: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
|
|
||||||
const localObservable = new NopeObservable<number>();
|
const localObservable = new NopeObservable<number>();
|
||||||
localObservable.subscribe((data) => {
|
localObservable.subscribe((data) => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@ -41,12 +44,12 @@ const main = async () => {
|
|||||||
|
|
||||||
local.registerObservable(localObservable, {
|
local.registerObservable(localObservable, {
|
||||||
mode: "subscribe",
|
mode: "subscribe",
|
||||||
topic:"topic"
|
topic: "topic",
|
||||||
|
schema: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
remoteObservable.setContent(1338);
|
remoteObservable.setContent(1338);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await local.performCall("unkown", []);
|
await local.performCall("unkown", []);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -54,81 +57,44 @@ const main = async () => {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = await local.performCall<number>("functionRemote", [1, 2, async (a, b) => {
|
let res = await local.performCall<number>("functionRemote", [
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
async (a, b) => {
|
||||||
console.log("local callback");
|
console.log("local callback");
|
||||||
return a + b;
|
return a + b;
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
console.log("1", res);
|
console.log("1", res);
|
||||||
|
|
||||||
res = await local.methodInterface.functionRemote<number>(1, 2, async (a, b) => {
|
res = await local.methodInterface.functionRemote<number>(
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
async (a, b) => {
|
||||||
console.log("local callback");
|
console.log("local callback");
|
||||||
return a * b;
|
return a * b;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
remote.registerInternalInstanceGenerator("class", async (dispather, identifier) => {
|
|
||||||
const ret: IRemoteInstance = {
|
|
||||||
dispose: async () => {
|
|
||||||
console.log("dispise");
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
|
|
||||||
},
|
|
||||||
init: async (... args) => {
|
|
||||||
console.log("INIT with", args);
|
|
||||||
},
|
|
||||||
type: "class"
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("CREATED INSTANCE of type \"class\" with args",dispather.id, identifier);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}, {
|
|
||||||
mode: "external"
|
|
||||||
});
|
|
||||||
|
|
||||||
local.registerInstanceGenerator("class", async (dispather, identifier) => {
|
|
||||||
const ret: IRemoteInstance = {
|
|
||||||
dispose: async () => {
|
|
||||||
console.log("dispise");
|
|
||||||
},
|
|
||||||
identifier: "null",
|
|
||||||
init: async (... args) => {
|
|
||||||
console.log("INIT with", args);
|
|
||||||
},
|
|
||||||
type: "class"
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("CREATED Wrapper for", identifier);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}, {
|
|
||||||
mode: "internal"
|
|
||||||
});
|
|
||||||
|
|
||||||
const instance_01= await local.generateInstance({
|
|
||||||
identifier: "obj1",
|
|
||||||
params: ["hello","world"],
|
|
||||||
type: "class"
|
|
||||||
});
|
|
||||||
|
|
||||||
const instance_02 = await local.generateInstance({
|
|
||||||
identifier: "obj1",
|
|
||||||
params: ["hello","world"],
|
|
||||||
type: "class"
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
const benchmark = generateBenchmarkFunction(max, "");
|
const benchmark = generateBenchmarkFunction(max, "");
|
||||||
|
|
||||||
while (i < max * 10) {
|
while (i < max * 10) {
|
||||||
await local.performCall<number>("functionRemote", [1, 2, async (a, b) => {
|
// await local.performCall<number>(
|
||||||
return 1;
|
// "functionRemote",
|
||||||
}], {
|
// [
|
||||||
deletableCallbacks: [2],
|
// 1,
|
||||||
});
|
// 2,
|
||||||
|
// async (a, b) => {
|
||||||
|
// return 1;
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// {
|
||||||
|
// deletableCallbacks: [2]
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
benchmark();
|
benchmark();
|
||||||
|
|
||||||
@ -148,13 +114,12 @@ const main = async () => {
|
|||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < max * 10) {
|
while (i < max * 10) {
|
||||||
await benchmark();
|
await _benchmark();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await local.dispose();
|
||||||
|
await remote.dispose();
|
||||||
};
|
};
|
||||||
|
|
||||||
main().catch(console.error);
|
main().catch(console.error);
|
||||||
|
|
||||||
setTimeout(console.log, 10000, "done");
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user