@webda/async 4.0.0-beta.2 → 4.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -4
- package/lib/{models.d.ts → asyncaction.model.d.ts} +75 -37
- package/lib/asyncaction.model.d.ts.map +1 -0
- package/lib/asyncaction.model.js +269 -0
- package/lib/asyncaction.model.js.map +1 -0
- package/lib/index.d.ts +6 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -4
- package/lib/index.js.map +1 -1
- package/lib/services/asyncevents.service.d.ts +154 -0
- package/lib/services/asyncevents.service.d.ts.map +1 -0
- package/lib/services/asyncevents.service.js +219 -0
- package/lib/services/asyncevents.service.js.map +1 -0
- package/lib/services/{asyncjobservice.d.ts → asyncjobservice.service.d.ts} +78 -61
- package/lib/services/asyncjobservice.service.d.ts.map +1 -0
- package/lib/services/asyncjobservice.service.js +584 -0
- package/lib/services/asyncjobservice.service.js.map +1 -0
- package/lib/services/{localrunner.d.ts → localrunner.service.d.ts} +24 -10
- package/lib/services/localrunner.service.d.ts.map +1 -0
- package/lib/services/localrunner.service.js +87 -0
- package/lib/services/localrunner.service.js.map +1 -0
- package/lib/services/{runner.d.ts → runner.service.d.ts} +17 -12
- package/lib/services/runner.service.d.ts.map +1 -0
- package/lib/services/{runner.js → runner.service.js} +16 -13
- package/lib/services/runner.service.js.map +1 -0
- package/lib/services/servicerunner.service.d.ts +105 -0
- package/lib/services/servicerunner.service.d.ts.map +1 -0
- package/lib/services/servicerunner.service.js +131 -0
- package/lib/services/servicerunner.service.js.map +1 -0
- package/package.json +32 -42
- package/webda.module.json +1925 -890
- package/lib/models.d.ts.map +0 -1
- package/lib/models.js +0 -179
- package/lib/models.js.map +0 -1
- package/lib/models.spec.d.ts +0 -7
- package/lib/models.spec.d.ts.map +0 -1
- package/lib/models.spec.js +0 -64
- package/lib/models.spec.js.map +0 -1
- package/lib/services/asyncjobservice.d.ts.map +0 -1
- package/lib/services/asyncjobservice.js +0 -469
- package/lib/services/asyncjobservice.js.map +0 -1
- package/lib/services/asyncjobservice.spec.d.ts +0 -2
- package/lib/services/asyncjobservice.spec.d.ts.map +0 -1
- package/lib/services/asyncjobservice.spec.js +0 -561
- package/lib/services/asyncjobservice.spec.js.map +0 -1
- package/lib/services/localrunner.d.ts.map +0 -1
- package/lib/services/localrunner.js +0 -70
- package/lib/services/localrunner.js.map +0 -1
- package/lib/services/localrunner.spec.d.ts +0 -2
- package/lib/services/localrunner.spec.d.ts.map +0 -1
- package/lib/services/localrunner.spec.js +0 -113
- package/lib/services/localrunner.spec.js.map +0 -1
- package/lib/services/runner.d.ts.map +0 -1
- package/lib/services/runner.js.map +0 -1
- package/lib/services/servicerunner.d.ts +0 -68
- package/lib/services/servicerunner.d.ts.map +0 -1
- package/lib/services/servicerunner.js +0 -97
- package/lib/services/servicerunner.js.map +0 -1
- package/lib/services/servicerunner.spec.d.ts +0 -2
- package/lib/services/servicerunner.spec.d.ts.map +0 -1
- package/lib/services/servicerunner.spec.js +0 -111
- package/lib/services/servicerunner.spec.js.map +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { SpawnOptions } from "node:child_process";
|
|
2
|
+
import type { AsyncAction } from "../asyncaction.model.js";
|
|
3
|
+
import type { JobInfo } from "./asyncjobservice.service.js";
|
|
4
|
+
import { AgentInfo, Runner, RunnerParameters } from "./runner.service.js";
|
|
5
|
+
/**
|
|
6
|
+
* LocalRunner parameters
|
|
7
|
+
*/
|
|
6
8
|
export declare class LocalRunnerParameters extends RunnerParameters {
|
|
7
9
|
/**
|
|
8
10
|
* Command to launch
|
|
@@ -22,7 +24,12 @@ export declare class LocalRunnerParameters extends RunnerParameters {
|
|
|
22
24
|
* Use the observability of ChildProcess to update status accordingly
|
|
23
25
|
*/
|
|
24
26
|
autoStatus?: boolean;
|
|
25
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @override
|
|
29
|
+
* @param params - the input parameters
|
|
30
|
+
* @returns this
|
|
31
|
+
*/
|
|
32
|
+
load(params?: any): this;
|
|
26
33
|
}
|
|
27
34
|
/**
|
|
28
35
|
* Type of action returned by LocalRunner
|
|
@@ -38,13 +45,20 @@ export interface ProcessAction {
|
|
|
38
45
|
*/
|
|
39
46
|
export default class LocalRunner<T extends LocalRunnerParameters = LocalRunnerParameters> extends Runner<T> {
|
|
40
47
|
/**
|
|
41
|
-
*
|
|
48
|
+
* Spawn the process
|
|
49
|
+
* @param command - the command
|
|
50
|
+
* @param args - the arguments
|
|
51
|
+
* @param options - the spawn options
|
|
52
|
+
* @returns the child process
|
|
42
53
|
*/
|
|
43
|
-
|
|
44
|
-
spawn(command: string, args: string[], options?: SpawnOptions | undefined): import("child_process").ChildProcess;
|
|
54
|
+
spawn(command: string, args: string[], options?: SpawnOptions | undefined): import("node:child_process").ChildProcess;
|
|
45
55
|
/**
|
|
46
56
|
* @inheritdoc
|
|
57
|
+
* @param action - the action to launch
|
|
58
|
+
* @param info - the job information
|
|
59
|
+
* @returns the process information
|
|
47
60
|
*/
|
|
48
61
|
launchAction(action: AsyncAction, info: JobInfo): Promise<ProcessAction>;
|
|
49
62
|
}
|
|
50
|
-
|
|
63
|
+
export { LocalRunner };
|
|
64
|
+
//# sourceMappingURL=localrunner.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localrunner.service.d.ts","sourceRoot":"","sources":["../../src/services/localrunner.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,gBAAgB;IACzD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAE,GAAQ,GAAG,IAAI,CAK3B;CACF;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IACzG;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,6CAGxE;IAED;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAkD7E;CACF;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { Runner, RunnerParameters } from "./runner.service.js";
|
|
3
|
+
/**
|
|
4
|
+
* LocalRunner parameters
|
|
5
|
+
*/
|
|
6
|
+
export class LocalRunnerParameters extends RunnerParameters {
|
|
7
|
+
/**
|
|
8
|
+
* @override
|
|
9
|
+
* @param params - the input parameters
|
|
10
|
+
* @returns this
|
|
11
|
+
*/
|
|
12
|
+
load(params = {}) {
|
|
13
|
+
var _a;
|
|
14
|
+
super.load(params);
|
|
15
|
+
this.options ?? (this.options = {});
|
|
16
|
+
(_a = this.options).env ?? (_a.env = {});
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Run a Job locally on the server by spawning a child process
|
|
22
|
+
*
|
|
23
|
+
* @WebdaModda
|
|
24
|
+
*/
|
|
25
|
+
export default class LocalRunner extends Runner {
|
|
26
|
+
/**
|
|
27
|
+
* Spawn the process
|
|
28
|
+
* @param command - the command
|
|
29
|
+
* @param args - the arguments
|
|
30
|
+
* @param options - the spawn options
|
|
31
|
+
* @returns the child process
|
|
32
|
+
*/
|
|
33
|
+
spawn(command, args, options) {
|
|
34
|
+
/* c8 ignore next 2 */
|
|
35
|
+
return spawn(command, args, options);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @inheritdoc
|
|
39
|
+
* @param action - the action to launch
|
|
40
|
+
* @param info - the job information
|
|
41
|
+
* @returns the process information
|
|
42
|
+
*/
|
|
43
|
+
async launchAction(action, info) {
|
|
44
|
+
const envs = {
|
|
45
|
+
...this.parameters.options?.env,
|
|
46
|
+
...info
|
|
47
|
+
};
|
|
48
|
+
this.log("INFO", "Job", action.uuid, "started with", Object.keys(envs)
|
|
49
|
+
.map(k => `${k}=${envs[k]}`)
|
|
50
|
+
.join(" "), this.parameters.command, this.parameters.args ? this.parameters.args.map(a => `'${a}'`).join(" ") : "");
|
|
51
|
+
const child = this.spawn(this.parameters.command, this.parameters.args || [], {
|
|
52
|
+
...this.parameters.options,
|
|
53
|
+
env: envs,
|
|
54
|
+
detached: true
|
|
55
|
+
});
|
|
56
|
+
// AutoStatus based on process info
|
|
57
|
+
if (this.parameters.autoStatus && child) {
|
|
58
|
+
const repository = action.getRepository();
|
|
59
|
+
// Chain the writes so concurrent output does not lose lines
|
|
60
|
+
let logs = Promise.resolve();
|
|
61
|
+
const addLog = data => {
|
|
62
|
+
logs = logs.then(() => repository.upsertItemToCollection(action.uuid, "logs", data.toString()));
|
|
63
|
+
return logs;
|
|
64
|
+
};
|
|
65
|
+
child.stdout?.on("data", addLog);
|
|
66
|
+
child.stderr?.on("data", addLog);
|
|
67
|
+
// As this is local just and mostly used for batch auto status it
|
|
68
|
+
await repository.patch(action.uuid, { status: "RUNNING" });
|
|
69
|
+
child.on("exit", async (code) => {
|
|
70
|
+
if (code !== 0) {
|
|
71
|
+
this.log("INFO", "Job", action.uuid, "errored with", code);
|
|
72
|
+
await repository.patch(action.uuid, { status: "ERROR" });
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.log("INFO", "Job", action.uuid, "successful");
|
|
76
|
+
await repository.patch(action.uuid, { status: "SUCCESS" });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
agent: Runner.getAgentInfo(),
|
|
82
|
+
pid: child?.pid || -1
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export { LocalRunner };
|
|
87
|
+
//# sourceMappingURL=localrunner.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localrunner.service.js","sourceRoot":"","sources":["../../src/services/localrunner.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAa,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,gBAAgB;IAoBzD;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAQ,EAAE;;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,IAAI,CAAC,OAAO,KAAZ,IAAI,CAAC,OAAO,GAAK,EAAE,EAAC;QACpB,MAAA,IAAI,CAAC,OAAO,EAAC,GAAG,QAAH,GAAG,GAAK,EAAE,EAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAUD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,WAAqE,SAAQ,MAAS;IACzG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KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;SACtB,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { Service, ServiceParameters } from "@webda/core";
|
|
2
|
-
import { AsyncAction } from "../
|
|
3
|
-
import { JobInfo } from "./asyncjobservice.js";
|
|
2
|
+
import type { AsyncAction } from "../asyncaction.model.js";
|
|
3
|
+
import type { JobInfo } from "./asyncjobservice.service.js";
|
|
4
|
+
/**
|
|
5
|
+
* Runner parameters
|
|
6
|
+
*/
|
|
4
7
|
export declare class RunnerParameters extends ServiceParameters {
|
|
5
8
|
/**
|
|
6
9
|
* Actions managed by the runner
|
|
7
10
|
* @default []
|
|
8
11
|
*/
|
|
9
12
|
actions?: string[];
|
|
10
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @override
|
|
15
|
+
* @param params - the input parameters
|
|
16
|
+
* @returns this
|
|
17
|
+
*/
|
|
18
|
+
load(params?: any): this;
|
|
11
19
|
}
|
|
12
20
|
/**
|
|
13
21
|
* Agent Information
|
|
@@ -29,25 +37,22 @@ export interface NodeAgentInfo extends AgentInfo {
|
|
|
29
37
|
* Runner take and launch an action
|
|
30
38
|
*/
|
|
31
39
|
export declare abstract class Runner<T extends RunnerParameters = RunnerParameters> extends Service<T> {
|
|
32
|
-
/**
|
|
33
|
-
* @inheritdoc
|
|
34
|
-
*/
|
|
35
|
-
loadParameters(params: any): ServiceParameters;
|
|
36
40
|
/**
|
|
37
41
|
* Handle this type of action
|
|
38
|
-
* @param type
|
|
39
|
-
* @returns
|
|
42
|
+
* @param type - the action type
|
|
43
|
+
* @returns true if the runner handles it
|
|
40
44
|
*/
|
|
41
45
|
handleType(type: string): boolean;
|
|
42
46
|
/**
|
|
43
47
|
* Return agent information
|
|
44
|
-
* @returns
|
|
48
|
+
* @returns the agent information
|
|
45
49
|
*/
|
|
46
50
|
static getAgentInfo(): AgentInfo;
|
|
47
51
|
/**
|
|
48
52
|
* Launch the action
|
|
49
|
-
* @param action
|
|
53
|
+
* @param action - the action to launch
|
|
54
|
+
* @param info - the job information
|
|
50
55
|
*/
|
|
51
56
|
abstract launchAction(action: AsyncAction, info: JobInfo): Promise<any>;
|
|
52
57
|
}
|
|
53
|
-
//# sourceMappingURL=runner.d.ts.map
|
|
58
|
+
//# sourceMappingURL=runner.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.service.d.ts","sourceRoot":"","sources":["../../src/services/runner.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB;IACrD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAE,GAAQ,GAAG,IAAI,CAI3B;CACF;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,8BAAsB,MAAM,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IAC5F;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY,IAAI,SAAS,CAQ/B;IACD;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACzE"}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { Service, ServiceParameters } from "@webda/core";
|
|
2
|
-
import * as os from "os";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
/**
|
|
4
|
+
* Runner parameters
|
|
5
|
+
*/
|
|
3
6
|
export class RunnerParameters extends ServiceParameters {
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @override
|
|
9
|
+
* @param params - the input parameters
|
|
10
|
+
* @returns this
|
|
11
|
+
*/
|
|
12
|
+
load(params = {}) {
|
|
13
|
+
super.load(params);
|
|
6
14
|
this.actions ?? (this.actions = []);
|
|
15
|
+
return this;
|
|
7
16
|
}
|
|
8
17
|
}
|
|
9
18
|
/**
|
|
10
19
|
* Runner take and launch an action
|
|
11
20
|
*/
|
|
12
21
|
export class Runner extends Service {
|
|
13
|
-
/**
|
|
14
|
-
* @inheritdoc
|
|
15
|
-
*/
|
|
16
|
-
loadParameters(params) {
|
|
17
|
-
return new RunnerParameters(params);
|
|
18
|
-
}
|
|
19
22
|
/**
|
|
20
23
|
* Handle this type of action
|
|
21
|
-
* @param type
|
|
22
|
-
* @returns
|
|
24
|
+
* @param type - the action type
|
|
25
|
+
* @returns true if the runner handles it
|
|
23
26
|
*/
|
|
24
27
|
handleType(type) {
|
|
25
28
|
return this.parameters.actions?.includes(type) ?? false;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Return agent information
|
|
29
|
-
* @returns
|
|
32
|
+
* @returns the agent information
|
|
30
33
|
*/
|
|
31
34
|
static getAgentInfo() {
|
|
32
35
|
return {
|
|
@@ -38,4 +41,4 @@ export class Runner extends Service {
|
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
|
-
//# sourceMappingURL=runner.js.map
|
|
44
|
+
//# sourceMappingURL=runner.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.service.js","sourceRoot":"","sources":["../../src/services/runner.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IAOrD;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAQ,EAAE;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,IAAI,CAAC,OAAO,KAAZ,IAAI,CAAC,OAAO,GAAK,EAAE,EAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAoBD;;GAEG;AACH,MAAM,OAAgB,MAAsD,SAAQ,OAAU;IAC5F;;;;OAIG;IACH,UAAU,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY;QACjB,OAAO;YACL,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE;YACvB,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE;YACvB,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE;YACrB,MAAM,EAAE,EAAE,CAAC,QAAQ,EAAE;YACrB,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;SAChB,CAAC;IACJ,CAAC;CAOF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { OperationContext } from "@webda/core";
|
|
2
|
+
import { MemoryLogger, WorkerLogLevel, WorkerMessage, WorkerOutput } from "@webda/workout";
|
|
3
|
+
import { AsyncAction } from "../asyncaction.model.js";
|
|
4
|
+
import type { JobInfo } from "./asyncjobservice.service.js";
|
|
5
|
+
import { AgentInfo, Runner, RunnerParameters } from "./runner.service.js";
|
|
6
|
+
/**
|
|
7
|
+
* Type of action returned by LocalRunner
|
|
8
|
+
*/
|
|
9
|
+
export interface ServiceAction {
|
|
10
|
+
/**
|
|
11
|
+
* Info on the server running it
|
|
12
|
+
*/
|
|
13
|
+
agent: AgentInfo;
|
|
14
|
+
/**
|
|
15
|
+
* Promise of the implementation
|
|
16
|
+
*
|
|
17
|
+
* Useful for unit test
|
|
18
|
+
*/
|
|
19
|
+
promise: Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Object receiving the captured logs
|
|
23
|
+
*/
|
|
24
|
+
export type ActionLogTarget = {
|
|
25
|
+
patch(data: {
|
|
26
|
+
logs: string[];
|
|
27
|
+
}): Promise<any>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Keep log in memory and save it to the action object every 5s
|
|
31
|
+
*/
|
|
32
|
+
export declare class ActionMemoryLogger extends MemoryLogger {
|
|
33
|
+
protected action: ActionLogTarget;
|
|
34
|
+
logSaveDelay: number;
|
|
35
|
+
format?: string;
|
|
36
|
+
protected timeout: NodeJS.Timeout;
|
|
37
|
+
/**
|
|
38
|
+
* @param output - the worker output to listen to
|
|
39
|
+
* @param level - the log level
|
|
40
|
+
* @param limit - the maximum number of logs
|
|
41
|
+
* @param action - the action to save logs to
|
|
42
|
+
* @param logSaveDelay - delay before saving logs
|
|
43
|
+
* @param format - the log format
|
|
44
|
+
*/
|
|
45
|
+
constructor(output: WorkerOutput, level: WorkerLogLevel, limit: number, action: ActionLogTarget, logSaveDelay: number, format?: string);
|
|
46
|
+
/**
|
|
47
|
+
* Schedule a save on each message
|
|
48
|
+
* @param msg - the message
|
|
49
|
+
*/
|
|
50
|
+
onMessage(msg: WorkerMessage): void;
|
|
51
|
+
/**
|
|
52
|
+
* Save the logs to the action
|
|
53
|
+
*/
|
|
54
|
+
save(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Close the logger and save the logs
|
|
57
|
+
* @returns the save promise
|
|
58
|
+
*/
|
|
59
|
+
saveAndClose(): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Add the log format to capture
|
|
63
|
+
*/
|
|
64
|
+
export declare class ServiceRunnerParameters extends RunnerParameters {
|
|
65
|
+
/**
|
|
66
|
+
* Define the log format
|
|
67
|
+
*
|
|
68
|
+
* @default ConsoleLoggerDefaultFormat
|
|
69
|
+
*/
|
|
70
|
+
logFormat?: string;
|
|
71
|
+
/**
|
|
72
|
+
* How long before saving logs (in ms)
|
|
73
|
+
*
|
|
74
|
+
* @default 5000
|
|
75
|
+
*/
|
|
76
|
+
logSaveDelay?: number;
|
|
77
|
+
/**
|
|
78
|
+
* @override
|
|
79
|
+
* @param params - the input parameters
|
|
80
|
+
* @returns this
|
|
81
|
+
*/
|
|
82
|
+
load(params?: any): this;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Run a Job locally on the server by spawning a child process
|
|
86
|
+
*
|
|
87
|
+
* @WebdaModda
|
|
88
|
+
*/
|
|
89
|
+
export default class ServiceRunner<T extends ServiceRunnerParameters = ServiceRunnerParameters> extends Runner<T> {
|
|
90
|
+
/**
|
|
91
|
+
* Rebuild an operation context if the action was loaded from a store
|
|
92
|
+
* @param context - the stored context
|
|
93
|
+
* @returns an operation context
|
|
94
|
+
*/
|
|
95
|
+
protected getOperationContext(context: any): OperationContext;
|
|
96
|
+
/**
|
|
97
|
+
* @inheritdoc
|
|
98
|
+
* @param action - the action to launch
|
|
99
|
+
* @param info - the job information
|
|
100
|
+
* @returns the service action
|
|
101
|
+
*/
|
|
102
|
+
launchAction(action: AsyncAction, info: JobInfo): Promise<ServiceAction>;
|
|
103
|
+
}
|
|
104
|
+
export { ServiceRunner };
|
|
105
|
+
//# sourceMappingURL=servicerunner.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servicerunner.service.d.ts","sourceRoot":"","sources":["../../src/services/serv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BAAgB;IAC3D;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAE,GAAQ,GAAG,IAAI,CAI3B;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa,CAAC,CAAC,SAAS,uBAAuB,GAAG,uBAAuB,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IAC/G;;;;OAIG;IACH,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,GAAG,GAAG,gBAAgB,CAQ5D;IAED;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CA6C7E;CACF;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { callOperation, OperationContext, SimpleOperationContext, useApplication, useDynamicService } from "@webda/core";
|
|
2
|
+
import { ConsoleLogger, MemoryLogger, useWorkerOutput } from "@webda/workout";
|
|
3
|
+
import { AsyncOperationAction, AsyncWebdaAction } from "../asyncaction.model.js";
|
|
4
|
+
import { Runner, RunnerParameters } from "./runner.service.js";
|
|
5
|
+
/**
|
|
6
|
+
* Keep log in memory and save it to the action object every 5s
|
|
7
|
+
*/
|
|
8
|
+
export class ActionMemoryLogger extends MemoryLogger {
|
|
9
|
+
/**
|
|
10
|
+
* @param output - the worker output to listen to
|
|
11
|
+
* @param level - the log level
|
|
12
|
+
* @param limit - the maximum number of logs
|
|
13
|
+
* @param action - the action to save logs to
|
|
14
|
+
* @param logSaveDelay - delay before saving logs
|
|
15
|
+
* @param format - the log format
|
|
16
|
+
*/
|
|
17
|
+
constructor(output, level, limit, action, logSaveDelay, format) {
|
|
18
|
+
super(output, level, limit);
|
|
19
|
+
this.action = action;
|
|
20
|
+
this.logSaveDelay = logSaveDelay;
|
|
21
|
+
this.format = format;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Schedule a save on each message
|
|
25
|
+
* @param msg - the message
|
|
26
|
+
*/
|
|
27
|
+
onMessage(msg) {
|
|
28
|
+
super.onMessage(msg);
|
|
29
|
+
if (!this.timeout) {
|
|
30
|
+
this.timeout = setTimeout(() => this.save(), this.logSaveDelay);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Save the logs to the action
|
|
35
|
+
*/
|
|
36
|
+
async save() {
|
|
37
|
+
if (this.timeout) {
|
|
38
|
+
clearTimeout(this.timeout);
|
|
39
|
+
this.timeout = undefined;
|
|
40
|
+
}
|
|
41
|
+
await this.action.patch({ logs: this.getLogs().map(msg => ConsoleLogger.format(msg, this.format)) });
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Close the logger and save the logs
|
|
45
|
+
* @returns the save promise
|
|
46
|
+
*/
|
|
47
|
+
async saveAndClose() {
|
|
48
|
+
this.close();
|
|
49
|
+
return this.save();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Add the log format to capture
|
|
54
|
+
*/
|
|
55
|
+
export class ServiceRunnerParameters extends RunnerParameters {
|
|
56
|
+
/**
|
|
57
|
+
* @override
|
|
58
|
+
* @param params - the input parameters
|
|
59
|
+
* @returns this
|
|
60
|
+
*/
|
|
61
|
+
load(params = {}) {
|
|
62
|
+
super.load(params);
|
|
63
|
+
this.logSaveDelay ?? (this.logSaveDelay = 5000);
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Run a Job locally on the server by spawning a child process
|
|
69
|
+
*
|
|
70
|
+
* @WebdaModda
|
|
71
|
+
*/
|
|
72
|
+
export default class ServiceRunner extends Runner {
|
|
73
|
+
/**
|
|
74
|
+
* Rebuild an operation context if the action was loaded from a store
|
|
75
|
+
* @param context - the stored context
|
|
76
|
+
* @returns an operation context
|
|
77
|
+
*/
|
|
78
|
+
getOperationContext(context) {
|
|
79
|
+
if (context instanceof OperationContext) {
|
|
80
|
+
return context;
|
|
81
|
+
}
|
|
82
|
+
const input = context?.input;
|
|
83
|
+
return new SimpleOperationContext().setInput(Buffer.isBuffer(input) ? input : input?.type === "Buffer" ? Buffer.from(input.data) : Buffer.from("{}"));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @inheritdoc
|
|
87
|
+
* @param action - the action to launch
|
|
88
|
+
* @param info - the job information
|
|
89
|
+
* @returns the service action
|
|
90
|
+
*/
|
|
91
|
+
async launchAction(action, info) {
|
|
92
|
+
if (!(action instanceof AsyncWebdaAction || action instanceof AsyncOperationAction)) {
|
|
93
|
+
this.log("ERROR", "Can only handle AsyncWebdaAction or AsyncOperationAction got", action.constructor.name);
|
|
94
|
+
throw new Error("Can only handle AsyncWebdaAction or AsyncOperationAction got " + action.constructor.name);
|
|
95
|
+
}
|
|
96
|
+
// Launch within current process
|
|
97
|
+
const promise = (async (action) => {
|
|
98
|
+
let logger;
|
|
99
|
+
try {
|
|
100
|
+
await action.patch({ status: "RUNNING" });
|
|
101
|
+
this.log("INFO", "Job", action.uuid, "started");
|
|
102
|
+
// Inject a MemoryLogger to capture and report any logs
|
|
103
|
+
logger = new ActionMemoryLogger(useApplication()?.getWorkerOutput() || useWorkerOutput(), action.logLevel, useDynamicService(info.JOB_ORCHESTRATOR)?.getParameters().logsLimit || 5000, action, this.parameters.logSaveDelay, this.parameters.logFormat);
|
|
104
|
+
if (action instanceof AsyncWebdaAction) {
|
|
105
|
+
await useDynamicService(action.serviceName)[action.method](...(action.arguments || []));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
await callOperation(this.getOperationContext(action.context), action.operationId);
|
|
109
|
+
}
|
|
110
|
+
await logger.saveAndClose();
|
|
111
|
+
await action.patch({ status: "SUCCESS" });
|
|
112
|
+
this.log("INFO", "Job", action.uuid, "finished");
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
await logger?.saveAndClose();
|
|
116
|
+
await action.patch({
|
|
117
|
+
status: "ERROR",
|
|
118
|
+
errorMessage: err.message,
|
|
119
|
+
errorName: err.name
|
|
120
|
+
});
|
|
121
|
+
this.log("ERROR", "Job", action.uuid, "errored", err);
|
|
122
|
+
}
|
|
123
|
+
})(action);
|
|
124
|
+
return {
|
|
125
|
+
agent: Runner.getAgentInfo(),
|
|
126
|
+
promise
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export { ServiceRunner };
|
|
131
|
+
//# sourceMappingURL=servicerunner.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servicerunner.service.js","sourceRoot":"","sources":["../../src/services/servicerunner.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,eAAe,EAIhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAa,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAuB1E;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAGlD;;;;;;;OAOG;IACH,YACE,MAAoB,EACpB,KAAqB,EACrB,KAAa,EACH,MAAuB,EAC1B,YAAoB,EACpB,MAAe;QAEtB,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;sBAJlB,MAAM;4BACT,YAAY;sBACZ,MAAM;IAGf,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,GAAkB;QAC1B,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,I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description": "Async System",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "tsc-esm",
|
|
8
|
-
"build:module": "webda build",
|
|
9
|
-
"build:watch": "webda build --watch",
|
|
10
|
-
"pretest": "npm run build",
|
|
11
|
-
"test": "c8 mocha",
|
|
12
|
-
"test:debug": "mocha --no-timeouts",
|
|
13
|
-
"run": "node core",
|
|
14
|
-
"format": "prettier --check src/**/*",
|
|
15
|
-
"lint": "eslint",
|
|
16
|
-
"lint:fix": "eslint --fix",
|
|
17
|
-
"format:fix": "prettier --write src/**/*"
|
|
18
|
-
},
|
|
19
6
|
"keywords": [
|
|
20
7
|
"webda-module"
|
|
21
8
|
],
|
|
@@ -25,34 +12,26 @@
|
|
|
25
12
|
"package.json"
|
|
26
13
|
],
|
|
27
14
|
"dependencies": {
|
|
28
|
-
"
|
|
29
|
-
"@webda/ql": "^4.0.0-beta.2",
|
|
30
|
-
"@webda/workout": "^4.0.0-beta.2",
|
|
31
|
-
"axios": "^1.1.3",
|
|
15
|
+
"axios": "^1.14.0",
|
|
32
16
|
"json-schema": "^0.4.0",
|
|
33
|
-
"node-cron": "^
|
|
17
|
+
"node-cron": "^4.2.1",
|
|
18
|
+
"@webda/core": "4.0.0-beta.4",
|
|
19
|
+
"@webda/utils": "4.0.0-beta.4",
|
|
20
|
+
"@webda/ql": "4.0.0-beta.3",
|
|
21
|
+
"@webda/workout": "4.0.0-beta.3"
|
|
34
22
|
},
|
|
35
23
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@types/node": "
|
|
38
|
-
"@
|
|
39
|
-
"
|
|
40
|
-
"sinon": "^
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"reporter": [
|
|
48
|
-
"html",
|
|
49
|
-
"lcov",
|
|
50
|
-
"json",
|
|
51
|
-
"text"
|
|
52
|
-
],
|
|
53
|
-
"exclude": [
|
|
54
|
-
"**/*.spec.ts"
|
|
55
|
-
]
|
|
24
|
+
"@types/json-schema": "^7.0.15",
|
|
25
|
+
"@types/node": "25.5.0",
|
|
26
|
+
"@vitest/coverage-v8": "^4.1.2",
|
|
27
|
+
"jscodeshift": "^17.3.0",
|
|
28
|
+
"sinon": "^21.0.3",
|
|
29
|
+
"skott": "^0.35.8",
|
|
30
|
+
"typescript": "7.1.0-dev.20260929.1",
|
|
31
|
+
"vite": "^6.0.0",
|
|
32
|
+
"vitest": "^4.1.2",
|
|
33
|
+
"@webda/compiler": "^4.0.0-beta.4",
|
|
34
|
+
"@webda/test": "4.0.0-beta.3"
|
|
56
35
|
},
|
|
57
36
|
"bugs": {
|
|
58
37
|
"url": "https://github.com/loopingz/webda.io/issues"
|
|
@@ -70,7 +49,7 @@
|
|
|
70
49
|
},
|
|
71
50
|
"type": "module",
|
|
72
51
|
"engines": {
|
|
73
|
-
"node": ">=
|
|
52
|
+
"node": ">=22.0.0"
|
|
74
53
|
},
|
|
75
54
|
"nx": {
|
|
76
55
|
"implicitDependencies": [
|
|
@@ -79,5 +58,16 @@
|
|
|
79
58
|
]
|
|
80
59
|
},
|
|
81
60
|
"license": "LGPL-3.0-only",
|
|
82
|
-
"
|
|
83
|
-
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "webdac build",
|
|
63
|
+
"build:watch": "webdac build --watch",
|
|
64
|
+
"pretest": "npm run build",
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"format": "prettier --check src/**/*",
|
|
67
|
+
"lint": "eslint",
|
|
68
|
+
"lint:fix": "eslint --fix",
|
|
69
|
+
"format:fix": "prettier --write src/**/*",
|
|
70
|
+
"deps:graph": "skott --showCircularDependencies --no-trackTypeOnlyDependencies --displayMode=raw -e .ts",
|
|
71
|
+
"codemod": "jscodeshift --parser=ts --extensions=tsx,ts -t ../codemod/current.mjs src"
|
|
72
|
+
}
|
|
73
|
+
}
|